Page 1 of 1

Labels disappering

Posted: Tue Jun 27, 2006 8:28 pm
by 9525016
If I have multiple vertical axes, each one having a label and I right click and drag up or down far enough, the labels will disappear from all of them at some point.

This may have something to do with the labels all being at the same point on each respective axis (0.0), though all of the axes are not lined up at the same y position (i.e. y=0.0 of one axis is not the same physical ordinate as the y=0.0 of another axis). Looks like some sort of clipping problem.

Is there a fix for this? Perhaps I can override the right click and drag so that I use my own scrolling mechinism? I've implemented a way for my vertical scrollbar to do this vertically, but I do not know how to stop the default mechinism from scrolling the graphs.

Thanks


Adrian

Posted: Wed Jun 28, 2006 10:01 am
by narcis
Hi Adrian,

I couldn't reproduce the problem here. Could you please send us an example we can run "as-is" and the steps we should follow to reproduce the issue here?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.

Code Post

Posted: Wed Jun 28, 2006 2:26 pm
by 9525016
Sorry for not posting my stuff in the newsgroup but I found that this is easier. Though, if you really want me to, I'll do it.

Below is a code fragment to replicate the problem. Create a default C++ MFC project dialogue project. Insert a defaut TChart Pro COM Object into the dialogue and put this into the OnInitDialog() function. You will of course have to include the appropriate header files.

Code: Select all

	CTChart& tchart = *(CTChart*)GetDlgItem(IDC_TCHART1);
	enum { eAllTraces = 10 };
	long AxisIds[eAllTraces];
	long LabelIds[eAllTraces];
	long TraceIds[eAllTraces];
	for (int index = 0
				; index < eAllTraces
				; ++index) {
		//------------------------------------------------------------------
		// Adding custom axis
		AxisIds[index] = tchart.GetAxis().AddCustom(false);
		CAxis& axis = tchart.GetAxis().GetCustom(AxisIds[index]);
		axis.SetMaximumOffset(axis.GetMaximumOffset()+10*index);
		axis.SetMinimumOffset(axis.GetMinimumOffset()-10*index);


		//------------------------------------------------------------------
		// Adding Label
		CAxisLabels& labels = axis.GetLabels();
		LabelIds[index] = labels.Add(0.0, "");
		// Setup label properties
		CAxisLabelsItem& label = labels.GetItem(LabelIds[index]);
		label.SetShapeStyle(fosRoundRectangle);
		label.GetFont().SetSize(10);
		label.GetFont().SetBold(true);
		label.SetTransparent(false);
		//label.SetVisible(false);

		//------------------------------------------------------------------
		// Adding series (trace)
		TraceIds[index] = tchart.AddSeries(scLine);
		CSeries& series = tchart.Series(TraceIds[index]);

		// Attach the series to the custom axis
		series.SetVerticalAxisCustom(AxisIds[index]);

		for (double x = 0; x < 1; x += .01) {
			double y = (((double)rand()) / RAND_MAX) * 0.2 - 0.1;
			series.AddXY(x, y, "", RGB(0xff, 0, 0));
		}
	}
When you right click and drag it up it will eventually make all labels disappear, even though not all labels have left the chart area.

I’ve fixed this by disabling the default scrolling routines and writing my own using the SetMaximumOffset()/SetMinimumOffset() axis functions to position all of the graphs.

Thanks,


Adrian

Posted: Fri Jun 30, 2006 11:31 am
by narcis
Hi Adrian,

Thanks for the code, I could reproduce the issue here and added it (TV52011535) to our defect list to be fixed for future releases.