Mark sometimes hides title

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Mark sometimes hides title

Post by qcrnd » Mon May 04, 2009 3:24 pm

Hi
We have a stacked bar chart with specific properties and we then add data.
It seems that in some configuration of data the mark goes over the series.
I have uploaded a sample project TChartV3TesterMarkOverTitle.zip which shows the problem .
Run the application and then press the button "Add Data"
you will see the mark covering the title.
We have 3 series which have data and it seems that it happens only if the top stack values are 0 i.e the topmost series in each bar has zero value for all the bars.
We use the mark the topmost series.
It seems also related to the specific properties of our chart .
Thanks.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Post by Sandra » Tue May 05, 2009 10:08 am

Hello gcrnd,


I could reproduce your isseu with your code, but using next simple code your not appears the problem, and works fine.

Code: Select all

        private Steema.TeeChart.Styles.Bar bar1, bar2, bar3;
        private void InitializeChart()
        {
            bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar2 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar3 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar1.Add(0);
            bar1.Add(1);
            bar1.Add(0);
            bar2.Add(0);
            bar2.Add(0);
            bar2.Add(0);
            bar3.Add(0);
            bar3.Add(0);
            bar3.Add(0);
            bar3.Marks.Visible = true;
            bar1.MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked;

        }

Please, make the necessary change this code because we can reproduce exactly your problem here.


Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Tue May 05, 2009 12:25 pm

Hi Sandra
I dont understand. If you can reproduce this then you have a bug which needs to be fixed. I CANNOT change my code becuase my code is MUCH more complicated then what I sent. I only sent you a sample to demonstrate the problem . In my real application the chart creation goes through alot of functionality which will be difficult to change.
This is a regression becuase we never saw this problem in version 2. And before we migrated to v3 we were told that there is full backwards compatibility , so I didnt expect to encounter any such problems.

I would prefer to know that this issue willl be fixed in your coming releases.
Thanks.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed May 06, 2009 9:28 am

Hi qcrnd,

Cleanning your project to the minimum I finally found which the problem is. This issue only occurs when setting series marks to non-visible and then setting them back to visible. This can be reproduce with this simple code:

Code: Select all

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

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

			bar1.Marks.Visible = false;
			bar2.Marks.Visible = false;
			bar3.Marks.Visible = false;

			bar1.Add(0);
			bar1.Add(1);
			bar1.Add(0);

			bar2.Add(0);
			bar2.Add(0);
			bar2.Add(0);

			bar3.Add(0);
			bar3.Add(0);
			bar3.Add(0);

			bar1.MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked;
			bar3.Marks.Visible = true;	
		}
I've checked that using code above same issue happens in TeeChart for .NET v2, v3 and TeeChart Pro v8 VCL so I reckon this has always been TeeChart's behavior.

Having said that, this code works fine:

Code: Select all

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

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

			//bar1.Marks.Visible = false;
			//bar2.Marks.Visible = false;
			//bar3.Marks.Visible = false;

			bar1.Add(0);
			bar1.Add(1);
			bar1.Add(0);

			bar2.Add(0);
			bar2.Add(0);
			bar2.Add(0);

			bar3.Add(0);
			bar3.Add(0);
			bar3.Add(0);

			bar1.MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked;
			bar1.Marks.Visible = false;
			bar3.Marks.Visible = false;
			//bar3.Marks.Visible = true;			
		}
So that in your project you can do this:

Code: Select all

    private void LoadInvisibleBarData()
    {
      int[,] data = new int[3, 3] { { 0, 0, 0 }, {1 ,0,0 }, { 0, 0, 0 } };
      Color[] seriesColors = new Color[] { Color.Blue, Color.Orange, Color.Peru, Color.Purple };

      for (int col = 0; col < 3; col++)
      {
        Bar series = CreateNewBarSeries(m_Chart, seriesColors[col]);

        for (int row = 0; row < 3; row++)
        {
          int yValue =  data[row, col];
          series.Add(yValue, "test");
        }
      }

			//m_Chart.Series[2].Marks.Visible = true;

			for (int j = 0; j < m_Chart.Series.Count-1; j++)
			{
				m_Chart[j].Marks.Visible = false;
			}
			
			for (int i = 0; i < 3; i++)
			{
				m_Chart.Series[2][i].Label = "test" + i.ToString();
			}
    }

    private Bar CreateNewBarSeries(TChart chart, Color color)
    {
      Bar series = new Bar(chart.Chart);
      series.Cursor = Cursors.Hand;
      series.Color = color;
      series.MultiBar = MultiBars.Stacked;
			//series.Marks.Visible = false;
      return series;
    }
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Thu May 07, 2009 9:58 am

HI Narcis
Thanks for the reply.
We will try and modify our application code to make sure that the workaround is Ok. Could be that we never saw it before because of the data we had.
I will let you know once we make the change . Like I said , I only sent a sample , the real code is much more complicated so it will take a little time.

Is this behaviour by design or is it a bug that will be reported to R&D for the future ?
It looks to me that this behaviour isnt correct.
Thanks.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu May 07, 2009 10:07 am

Hi qcrnd,

Thanks for the feedback.

The principle is pretty basic. Instead of hiding marks for all series and at the end of the process enabling those you want to display you should only disable marks for the series you don't want them to be visible.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Tue May 12, 2009 6:26 am

Hi Narcis
Sorry to say that your workaround didnt work for us. We did the changes in our application and we get the same problem. I then went to my sample project and also made the changes according to your specifications and STILL I see the problem.
I have uploaded the test sample TChartV3TesterMarkStillHidesTitle.zip so that you can see for yourself that your workaround doesnt help. PLEASE WORK ON OUR SAMPLE PROJECT. we are using stacked bars and with specific data. Maybe you tested something else.
Run the application and press the AddData button.
Thanks.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue May 12, 2009 8:43 am

Hi qcrnd,

Thanks for the information. The solution I suggested worked fine in the project you previously sent. In the current project it already works fine removing Marks.Visible=false code:

Code: Select all

    private void LoadInvisibleBarData()
    {
      int[,] data = new int[3, 3] { { 0, 0, 0 }, { 1, 0, 0 }, { 0, 0, 0 } };
      Color[] seriesColors = new Color[] { Color.Blue, Color.Orange, Color.Peru, Color.Purple };

      for (int col = 0; col < 3; col++)
      {
        Bar series = CreateNewBarSeries(m_Chart, seriesColors[col], col);
        for (int row = 0; row < 3; row++)
        {
          int yValue = data[row, col];
          series.Add(yValue, "test");
        }
				//if (col < 2)
				//  series.Marks.Visible = false;
      }
   }
Can you please confirm this works fine for you?

Anyway, I've added the issue to the defect list (TF02014147) to be investigated for future releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Post by qcrnd » Tue May 12, 2009 12:10 pm

Hi Narcis.
Once again , your workaround is good only in the sample. In my application the series values can be 0 or they can be other numbers
and if I remove the visible =false then I will get marks that shouldnt appear. Of course I can check the value and set the visible Only if value > 0.
For now we seem to have a workaround , instead of working with the visible property to false we set the mark text to empty.
In anycase I am glad you have added it to the defects list because it is a bug.
Thanks.

Post Reply