Page 1 of 1

Custom values/units display in Mark's values ?

Posted: Tue Jul 20, 2010 7:16 am
by 15050347
Hi,

I have the following problem/want to do the following:
* I have 2 bar series on a chart, one is % and one kW
* I want to display a mark above each bar containing the value and the unit
* The series name is the unit eg. % or kW
* The eventual value in the mark must be something like 56% or 312kW

Can I set Marks.Style to combine two different styles - a combination of TeeChart.EMarkStyle.smsValue and TeeChart.EMarkStyle.smsSeriesTitle will work

thanks

Dawie

Re: Custom values/units display in Mark's values ?

Posted: Tue Jul 20, 2010 11:40 am
by yeray
Hi Dawie,

You could use OnGetSeriesMark event to modify the text the marks will show. For example, in VB6:

Code: Select all

Private Sub TChart1_OnGetSeriesMark(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, MarkText As String)
  MarkText = Str$(TChart1.Series(SeriesIndex).YValues.Value(ValueIndex)) + TChart1.Series(SeriesIndex).Name
End Sub

Re: Custom values/units display in Mark's values ?

Posted: Tue Jul 20, 2010 3:29 pm
by 15050347
Yeray, thanks for the reply. I have got it working now, but I have one problem still:
* It seems that the event does not fire when I export the chart to a .tee file : Export.asNative.SaveToFile(..) (for view in IE) thus the edits I make in the MarkText is not brought forward to the chart that is displayed.
* But the event is called when exporting to a JPG (for view in Firefox) and the correct MarkText is displayed.

Is there some way to force the call of the event ?

thanks

Dawie

Re: Custom values/units display in Mark's values ?

Posted: Wed Jul 21, 2010 7:18 am
by narcis
Hi Dawie,

Try callling TChart1.Environment.InternalRepaint before exporting. This will force the chart being repainted internally.