Page 1 of 1

Mark sometimes hides title

Posted: Mon May 04, 2009 3:24 pm
by 9092401
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.

Posted: Tue May 05, 2009 10:08 am
by 10050769
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,

Posted: Tue May 05, 2009 12:25 pm
by 9092401
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.

Posted: Wed May 06, 2009 9:28 am
by narcis
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;
    }

Posted: Thu May 07, 2009 9:58 am
by 9092401
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.

Posted: Thu May 07, 2009 10:07 am
by narcis
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.

Posted: Tue May 12, 2009 6:26 am
by 9092401
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.

Posted: Tue May 12, 2009 8:43 am
by narcis
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.

Posted: Tue May 12, 2009 12:10 pm
by 9092401
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.