Page 1 of 1
Smart labels
Posted: Mon Jun 18, 2012 9:22 am
by 9530490
Buenos días,
tengo poca experiencia con TeeChart y no estoy seguro de como implementar una funcionalidad que necesitamos. Tenemos varias series cuyos valores en el eje X son índices crecientes que reflejan la posición del dato en la serie (0,1,2,3,4...). Como etiqueta se muestra la fecha asociada al dato. No puedo usar un eje X con valores de tiempo porque pueden existir varios datos para la misma fecha y fechas sin datos que no quiero mostrar en el gráfico.
Lo que me gustaría conseguir es un comportamiento más inteligente de las etiquetas ya que ahora se muestran algunas, no sé que criterio se usa para decidir cuales se muestran o si puedo cambiarlo, pero no ayudan a leer el gráfico. Lo que quiero es que se muestren marcas por días, meses o años.
He estado explorando un poco vuestra API y también el foro pero no tengo muy claro si vuestro software da algún mecanismo para conseguir esto de forma sencilla.
Saludos y muchas gracias,
Alex
P.D.: He visto que sólo hay entradas en inglés en el foro, escribo en castellano por comodidad, si el uso del inglés es obligatorio hacedmelo saber.
Re: Smart labels
Posted: Mon Jun 18, 2012 3:33 pm
by 9530490
I will try in English...
Hi all,
I am newbie. In our software we have several series with increasing values in X axis (0,1,2,3,4...). As labels we use date-time info. We cannot use date-time values in X axis because several values for the same date are possible.
I would like to have an smarter behaviour of the labels, some of the labels are shown but are useless for understanding the chart, I don´t know which criteria is used for selection or if I could change this criteria.
Anybody knows if exists a simpe way of achieve this smarter behaviour using TeeChart API?
Thanks and best regards.
Alex
Re: Smart labels
Posted: Tue Jun 19, 2012 10:52 am
by 10050769
Hello Alex,
I recommend you take a look in the Demo example concretely in the
All Features\Axes\Labels\Custom labels example where you find as you can use a custom labels. If it doesn't help you to achieve as you want please, let me know and if you can arrange for me an example because we can try to find a good solution for you using your data, would be very helpful.
Please note that the Custom labels example code is slightly out of date in the current version of this demo, the 'format' interface name requires to be added to some format features. Code example:
Code: Select all
TChart1.Axis.Left.Labels.Item(0).Format.Font.Size = 16
TChart1.Axis.Left.Labels.Add 466, "Good" & Chr(13) & "Bye"
TChart1.Axis.Left.Labels.Item(1).Format.Transparent = False
TChart1.Axis.Left.Labels.Add 300, ""
TChart1.Axis.Left.Labels.Add -100, ""
With TChart1.Axis.Left.Labels.Item(3).Format
.Transparent = False
.Transparency = 50
.Color = vbBlue
End With
We are correcting this code in the example for the next maintenance release.
Thanks,
Re: Smart labels
Posted: Tue Jun 19, 2012 11:08 am
by Marc
Hello Alex,
To add a little more background to working with Labels:
Although you haven't been able to do so in the case of you data, if possible the best way to work with dates would be to add them a X-values. You could add more detail to make them unique, for example by adding a time-stamp for hours:minutes:seconds. If that is not possible then you could add the data with date as a Label. The labels will be shown primarily in relation to the space they use. The minimum space between labels can be set by you if you require to do so.
eg.
If the Labels are too close together TeeChart won't plot the label unless you set the Separation property to a level where some Label overlapping might take place.
eg.
Code: Select all
TChart1.Axis.Bottom.Labels.Separation = 0
or
TChart1.Axis.Bottom.Labels.Separation = yourvalue
Thus you could set the increment to a value to match the index step you require and control the separation if you want more labels to show. If you have several values at one date and you wish to space them in a non-date-linear way then the technique of setting the increment to the data index step would probably be the best way.
Podemos recibir preguntas en castellano si es más conveniente, pero gracias de todas maneras para ponerlo en inglés que puede resultar más fácil para otros lectores del foro.
Regards,
Marc Meumann
Re: Smart labels
Posted: Thu Jun 21, 2012 12:10 pm
by 9530490
Thank for your replies, they are very usefull, I am going to study all the possibilities to find out the better way to achieve the goal.
Best regards and thanks again,
Alex
Re: Smart labels
Posted: Thu Jun 21, 2012 2:08 pm
by 10050769
Hello Alex,
I am glad our solution help you to solve your problem
Thanks,
Re: Smart labels
Posted: Mon Jun 25, 2012 1:34 pm
by 9530490
Hi,
I´m trying to use OnGetNextAxisLabel event to decide which axis labels should be displayed.
My software is written in Visual C++ and I have registered the event correctly because I receive the event. The problem is that only is received for labels on left axis. I never receive anything for the bottom axis which is the one that matters to me.
I am sure I have missed something but I don´t know what.
Any idea??
Best regards,
Alex
Re: Smart labels
Posted: Wed Jul 04, 2012 11:18 am
by 10050769
Hello Alex,
Sorry for the delay. In the attached project, appears a problem using OnGetAxisNextLabel, but I think isn't a same as you get, so OnGetAxisNextLabels is working to all labels of axes for me, but in bottom axis doesn't appear labels. For this reason, would be very helpful for us, if you can tell which version of TeeChartActivex are you using. On the other hand, if you use last version of TeeChartActiveX, can you confirm us, if the problem you can see in my code is the same as you have?
Thanks,
Re: Smart labels
Posted: Thu Jul 05, 2012 11:37 am
by 9530490
Hi,
I am using TeeChart Pro ActiveX 7.0.
After all I decided not to use OnGetAxisNextLabel and try with a different approach that finally became successfull. We have in mind to update to the newest version of TeeChart but at this moment is not a priority for us. When I update I will send feedback to you.
Anyway is not the same issue, my problem was that OnGetAxisNextLabel was only fired (or at least received) for labels on left axis.
Thanks and best regards,
Alex