Page 1 of 1

Bar chart hatch styles issue

Posted: Wed Nov 16, 2022 4:25 pm
by 21090946
Visual Studio 2022,
.net6.0,
Steema.TeeChart.NET.Business (5.2022.9.26)

Having issues with giving a single bar in a series a hatch style. I've included a minimum working example, where each generated image (53 in total) each look identical (matching the image provided below).

Code: Select all

foreach (HatchStyle hatchStyle in Enum.GetValues(typeof(HatchStyle)))
{
		TChart barChart = new TChart();            
        Bar bar = new Bar();
        bar.Add(10);
            
        bar.Brush.Style = hatchStyle;
        bar.Brush.Color = Color.Red;
        bar.Brush.ForegroundColor = Color.Blue;

        barChart.Series.Add(bar);
        
		// Export specifics
		var png = barChart.Export.Image.PNG;
        png.Width = 550;
        png.Height = 550;
        png.Save(@"C:\Users\...\HatchStyle" + hatchStyle + ".png");
]

Image

Re: Bar chart hatch styles issue

Posted: Mon Nov 21, 2022 8:43 am
by Christopher
Hello,

sorry for the delay in our reply. I think your result is expected, as for each loop you are creating a new instance of TChart. If I run the following code:

Code: Select all

  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private Steema.TeeChart.Styles.Bar bar1;

    private void InitializeChart()
    {

      foreach (Steema.TeeChart.Drawing.HatchStyle hatchStyle in Enum.GetValues(typeof(Steema.TeeChart.Drawing.HatchStyle)))
      {
        bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
        bar1.Add((int)hatchStyle);

        bar1.Brush.Style = hatchStyle;
        bar1.Brush.Color = Color.Red;
        bar1.Brush.ForegroundColor = Color.Blue;
      }

      tChart1.Header.Text += $" version {Steema.TeeChart.Utils.Version}";
    }
  }
}
I get what I think you expect:
Screenshot from 2022-11-21 09-42-06.png
Screenshot from 2022-11-21 09-42-06.png (81.13 KiB) Viewed 2963 times

Re: Bar chart hatch styles issue

Posted: Mon Nov 21, 2022 1:25 pm
by 21090946
Hi Christopher,

I am using a standard .net application format, so I am not too sure what the parent class "Form" would look like. I use a main method to run application, in my case, with the code I gave above wrapped inside.

Re: Bar chart hatch styles issue

Posted: Mon Nov 21, 2022 1:52 pm
by Christopher
Hello,

thank you, I think we've been able to reproduce your issue now, and have added it to our issue tracking software with id=2570. We will look into this issue when we can and will get back to you with a fix.

Re: Bar chart hatch styles issue

Posted: Fri Nov 25, 2022 2:54 pm
by Christopher
Hello,
Christopher wrote: ↑
Mon Nov 21, 2022 1:52 pm
thank you, I think we've been able to reproduce your issue now, and have added it to our issue tracking software with id=2570. We will look into this issue when we can and will get back to you with a fix.
These styles have now been partially implemented in the latest TeeChart Pro/Business NuGets. The following code:

Code: Select all

            var bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar1.Add(10);
            bar1.BarWidthPercent = 100;

            bar1.Brush.Style = Steema.TeeChart.Drawing.HatchStyle.BackwardDiagonal;
            bar1.Brush.Color = System.Drawing.Color.Red;
            bar1.Brush.ForegroundColor = System.Drawing.Color.Blue;

            tChart1.Header.Text += $" version {Steema.TeeChart.Utils.Version}";

            var png = tChart1.Export.Image.PNG;
            png.Width = 550;
            png.Height = 550;
            png.Save(path);

            new Process
            {
                StartInfo = new ProcessStartInfo(path)
                {
                    UseShellExecute = true
                }
            }.Start();
Now gives us:
Chart638049879823284847.png
Chart638049879823284847.png (18.78 KiB) Viewed 2844 times
This is a partial implementation, each implementation of a HatchStyle was much more time consuming that we had originally appreciated—if you find a HatchStyle that is not implemented but that you wish to use, please tell us and we will implement it for you.