Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 2451

Summary: Background gradients do not draw correctly
Product: .NET TeeChart Reporter: Brian Kohrs <bkohrs>
Component: .NET 5.0Assignee: Steema Issue Manager <issuemanager>
Status: RESOLVED FIXED    
Severity: major CC: chris
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:
Attachments: Examples of incorrect drawing
revised radial
revised fromcenter

Description Brian Kohrs 2021-07-12 15:03:34 EDT
Created attachment 972 [details]
Examples of incorrect drawing

When using Gradient.Style, neither of the PathGradientMode options draw correctly.

Using a .NET 5 console application with the latest Steema.TeeChart.NET NuGet package (4.2021.6.23), the following code will demonstrate the issue. When set to Radial, it draws a starburst pattern (and it takes a very long time to generate). When set to FromCenter, it draws a solid square, leaving one edge with a transparent background.

            var chart = new TChart();
            var area = new CustomArea();
            area.Add(1, 1);
            area.Add(2, 2);
            area.Add(3, 5);
            chart.Panel.Brush.Gradient.Visible = true;
            chart.Panel.Brush.Gradient.Style.Visible = true;
            chart.Panel.Brush.Gradient.Style.Direction = PathGradientMode.Radial;
            chart.Series.Add(area);
            chart.Export.Image.PNG.Width = 800;
            chart.Export.Image.PNG.Height = 600;
            chart.Export.Image.PNG.Save("test.png");

I have attached an image with both examples.
Comment 1 christopher ireland 2021-07-20 07:43:29 EDT
The Radial issue was a defect in the SixLabors library which I reported here:
https://github.com/SixLabors/ImageSharp.Drawing/issues/117

It is now fixed, I have updated the NuGet reference in our source-code to beta13, and it now works as expected.
Comment 2 christopher ireland 2021-07-20 10:07:56 EDT
Created attachment 974 [details]
revised radial

Created using TeeChart.Server.dll and the following code:

    static void Main(string[] args)
    {
      var chart = new TChart();
      var area = new Area();
      area.Add(1, 2);
      area.Add(2, 3);
      area.Add(3, 6);
      chart.Series.Add(area);
      chart.Panel.Brush.Gradient.Visible = true;
      chart.Panel.Brush.Gradient.StartColor = Color.Red;
      chart.Panel.Brush.Gradient.MiddleColor = Color.White;
      chart.Panel.Brush.Gradient.EndColor = Color.Blue;
      chart.Panel.Brush.Gradient.Style.Visible = true;
      chart.Panel.Brush.Gradient.Style.Direction = PathGradientMode.Radial;
      chart.Export.Image.PNG.Width = 800;
      chart.Export.Image.PNG.Height = 600;
      var path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "chart.png");

      chart.Export.Image.PNG.Save(path);

      new Process
      {
        StartInfo = new ProcessStartInfo(path)
        {
          UseShellExecute = true
        }
      }.Start();
    }
Comment 3 christopher ireland 2021-07-20 10:09:19 EDT
Created attachment 975 [details]
revised fromcenter

Created using TeeChart.Server.dll and the following code:

    static void Main(string[] args)
    {
      var chart = new TChart();
      var area = new Area();
      area.Add(1, 2);
      area.Add(2, 3);
      area.Add(3, 6);
      chart.Series.Add(area);
      chart.Panel.Brush.Gradient.Visible = true;
      chart.Panel.Brush.Gradient.StartColor = Color.Red;
      chart.Panel.Brush.Gradient.MiddleColor = Color.White;
      chart.Panel.Brush.Gradient.EndColor = Color.Blue;
      chart.Panel.Brush.Gradient.Style.Visible = true;
      chart.Panel.Brush.Gradient.Style.Direction = PathGradientMode.FromCenter;
      chart.Export.Image.PNG.Width = 800;
      chart.Export.Image.PNG.Height = 600;
      var path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "chart.png");

      chart.Export.Image.PNG.Save(path);

      new Process
      {
        StartInfo = new ProcessStartInfo(path)
        {
          UseShellExecute = true
        }
      }.Start();
    }
Comment 4 christopher ireland 2021-07-20 10:11:00 EDT
Marked as fixed - although these Gradients produced by TeeChart.Server.dll are not identical to those produced by TeeChart.WinForm.dll, we believe them to be acceptable given these two assemblies use different graphics libraries.