[vtkusers] Labels for Plots in vtkChart?

Marcus D. Hanwell marcus.hanwell at kitware.com
Mon Apr 20 13:08:40 EDT 2015


On Mon, Apr 20, 2015 at 12:51 PM, Joseph Melnyk <JMelnyk at pile.com> wrote:
> Is there a facility to add a label to a plot in vtkChart?  For example, have
> a specific value in the plot be labeled to indicate it’s special, or label
> the first value in the plot with the plot’s name?  From my understanding,
> nothing like this currently exists, and I’m exploring how difficult it would
> be to adapt what’s currently there.  It seems it may be possible to create
> something from vtkBlockItem or vtkTooltipItem to be “labels” but some scene
> coordinate translation would need to be done and vtkChartXY mouse events
> would need to move the objects around manually when the chart is
> zoomed/panned, etc…
>
This does not exist, the axes can have custom labels on them, i.e. set
5 to be Sun, 6 to be Moon, add numbers at other locations. It wouldn't
be too hard, I would derive from vtkPlot, or possibly vtkPlotPoints,
and add the code to render a label at the side of the selected points.

You can see how the tooltip item works, and that is certainly another
fairly easy way of doing it (vtkChartXY has the code, you could add a
tooltip item to the scene).

Hope that helps, it has been a while since I wrote some of this stuff
but I would probably try to reuse the tooltip item as you suggested.

Marcus


More information about the vtkusers mailing list