Bar chart hatch styles issue

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
podiumuser
Newbie
Newbie
Posts: 2
Joined: Tue Apr 06, 2021 12:00 am

Bar chart hatch styles issue

Post by podiumuser » Wed Nov 16, 2022 4:25 pm

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
Attachments
bar.png
bar.png (141.28 KiB) Viewed 5165 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Bar chart hatch styles issue

Post by Christopher » Mon Nov 21, 2022 8:43 am

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 5083 times
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

podiumuser
Newbie
Newbie
Posts: 2
Joined: Tue Apr 06, 2021 12:00 am

Re: Bar chart hatch styles issue

Post by podiumuser » Mon Nov 21, 2022 1:25 pm

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.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Bar chart hatch styles issue

Post by Christopher » Mon Nov 21, 2022 1:52 pm

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.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Bar chart hatch styles issue

Post by Christopher » Fri Nov 25, 2022 2:54 pm

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 4964 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.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply