Nevron Forum

how to use interactivitystyle in winchart?

https://www.nevron.com/Forum/Topic5131.aspx

By g wu - Saturday, May 7, 2011

Hi,

I am creating a xy point plot in winchart and need to add interactivity style so it will display the point values when mouse is over the point, below is my vb code, somehow it doesn't work-----no value displayed when mouse is over the point, can somebody give me advice? thanks.

Dim point As NPointSeries = chart.Series.Add(SeriesType.Point)

point.Name = "Point1"

point.InflateMargins = True

point.DataLabelStyle.Visible = False

point.FillStyle = New NColorFillStyle(Color.Red)

point.BorderStyle.Width = New NLength(1)

point.Size = New NLength(5, NRelativeUnit.ParentPercentage)

point.PointShape = PointShape.Bar

' point.InteractivityStyles(0) = interactivityStyle

point.UseXValues = True

For I = 0 To 10

point.XValues.Add(0.01 + I)

point.Values.Add(0.01 + I)

point.InteractivityStyles.Add(I, New NInteractivityStyle(CStr(I), CursorType.Hand))

Next

chart1.Refresh()

  

By Nevron Support - Monday, May 9, 2011

In order to enable tooltips you have to add an NTooltipTool instance to the chart controller:

nChartControl1.Controller.Tools.Add(New NTooltipTool())

In order to enable cursor changes you have to add an NCursorTool:

nChartControl1.Controller.Tools.Add(New NCursorTool())

If you want the tooltips to show just the data point index it is not necessary to add an individual interactivity style for each data point. You can use the following code:

point.InteractivityStyle = New NInteractivityStyle("", CursorType.Hand)

and remove

point.InteractivityStyles.Add(I, New NInteractivityStyle(CStr(I), CursorType.Hand))

from the For loop.