stacked bar issue with .net6

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
sihmon
Newbie
Newbie
Posts: 12
Joined: Thu Jul 14, 2022 12:00 am

stacked bar issue with .net6

Post by sihmon » Wed Oct 26, 2022 2:49 am

Visual Studio 2022, dotnet core6
Steema.TeeChart.NET(4.2022.10.11)


Hello Christopher

I want to use checkbox for legend,
I can't see the checkbox in the legend.

And if I remove the annotation and bar1 and bar2 have the 0th value, it works well.
However, when there is no 0th value, there is a problem with the 0th bar position, and there is a problem with the sort of the 2nd bar.
Is this a bug?
Please check it.

Code: Select all

public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private Steema.TeeChart.Styles.Bar bar1;
    private Steema.TeeChart.Styles.Bar bar2;
    private Steema.TeeChart.Styles.Bar bar3;

    private void InitializeChart()
    {
      this.bar1 = new Steema.TeeChart.Styles.Bar();
      this.bar2 = new Steema.TeeChart.Styles.Bar();
      this.bar3 = new Steema.TeeChart.Styles.Bar();

     this.bar1.Brush.Color = Color.Red;
     this.bar1.Title = "bar1";
     this.bar1.XValues.DataMember = "X";
     this.bar1.YValues.DataMember = "Bar";
     this.bar1.Marks.Visible = false;

     this.bar2.Brush.Color = Color.Green;
     this.bar2.Title = "bar2";
     this.bar2.XValues.DataMember = "X";
     this.bar2.YValues.DataMember = "Bar";
     this.bar2.Marks.Visible = false;

     this.bar3.Brush.Color = Color.Blue;
     this.bar3.Title = "bar3";
     this.bar3.XValues.DataMember = "X";
     this.bar3.YValues.DataMember = "Bar";
     this.bar3.Marks.Visible = false;

     this.tChart1.Series.Add(this.bar1);
     this.tChart1.Series.Add(this.bar2);
     this.tChart1.Series.Add(this.bar3);

     bar1.MultiBar = Steema.Teechart.Styles.MultiBars.Stacked;

     //bar1.Add(0,0);
     bar1.Add(1,100);
     bar1.Add(2,100);
     
     //bar2.Add(0,0);
     bar2.Add(1,90);
     bar2.Add(2,90);
     
     bar3.Add(0,70);
     bar3.Add(1,70);
     bar3.Add(2,70);

     tChart1.Legend.CheckBoxes = true;

      var assembly = Assembly.GetAssembly(typeof(TChart));
      var fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);

      tChart1.Header.Text += $" version {fvi.FileVersion}";
    }

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

Re: stacked bar issue with .net6

Post by Christopher » Wed Oct 26, 2022 3:17 pm

Hello,
sihmon wrote:
Wed Oct 26, 2022 2:49 am
I want to use checkbox for legend,
I can't see the checkbox in the legend.
This is because we used the ControlPaint class to draw the checkboxes in .NET Framework, but unfortunately this class doesn't exist in .NET 5.0/6.0. You will have to add in a Windows Form checkbox manually and use that, I'm afraid (with Legend.CheckBoxes set to false).
sihmon wrote:
Wed Oct 26, 2022 2:49 am
And if I remove the annotation and bar1 and bar2 have the 0th value, it works well.
However, when there is no 0th value, there is a problem with the 0th bar position, and there is a problem with the sort of the 2nd bar.
Is this a bug?
Please check it.
This hasn't changed between the thirteen year-old version:
Screenshot from 2022-10-26 17-04-23.png
Screenshot from 2022-10-26 17-04-23.png (90.74 KiB) Viewed 4823 times
and the most recent one:
Screenshot from 2022-10-26 17-06-53.png
Screenshot from 2022-10-26 17-06-53.png (26.88 KiB) Viewed 4823 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

sihmon
Newbie
Newbie
Posts: 12
Joined: Thu Jul 14, 2022 12:00 am

Re: stacked bar issue with .net6

Post by sihmon » Thu Oct 27, 2022 1:23 am

All right. I see.
I think the chart problem will be solved by adding the 0th value.
However, it is a problem that the check box is not available in Legend.
Thanks anyway.

Post Reply