Displaying DataSeries Label as Tooltip on Mouseover in Line Chart

To display DataSeries label as a tooltip on mouseover in a Line chart, use the following code:

DataSeries ds = new DataSeries()

{

   ValuesSource = new double[] { 1, 2, 3, 2 },

   ConnectionStrokeThickness = 5

};

ds.Loaded += (s, e) =>

{

  PlotElement pe = s as PlotElement;

  if (pe != null)

    pe.MouseEnter += (sender, ea) =>

     {

       Debug.WriteLine("Series index = {0}", pe.DataPoint.SeriesIndex);

     };

};

 

chart.Data.Children.Add(ds);

chart.ChartType = ChartType.Line;


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.