Using parameters of DataPoints from the series


Author
Message
Alexander Sorich
Alexander Sorich
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)
Group: Forum Members
Posts: 9, Visits: 1
Hello,
I'm looking for a funktion for
extract for parameter from series.
I'm using a Chart for .NET,
and I'm creating a series, for example NLineseries.
Then I'm adding a DataView to the serie.
If i'm click at the DataPoint in the series, i need the parameter from DataPoint
for example:
seriesName "Dataseries1"
seriesID "123456"
xvalue "01.07.2011"
value "45,67"
zvalue "123,456"

How can i extract there parameters?
I need there parameters not for a tooltip,
but for another funktion for example for output in the TextBox.

Best Regards,
Alexander
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi Alexander,

You can use the HitTest method for this purpose - take a look at the following code snippet:

  private void Form1_Load(object sender, EventArgs e)
  {
   NChart chart = nChartControl1.Charts[0];

   NBarSeries bar = new NBarSeries();
   bar.Values.Add(10);
   bar.Values.Add(20);
   bar.Values.Add(30);
   chart.Series.Add(bar);

   nChartControl1.MouseDown += new MouseEventHandler(nChartControl1_MouseDown);
  }

  void nChartControl1_MouseDown(object sender, MouseEventArgs e)
  {
   NHitTestResult result = nChartControl1.HitTest(e.X, e.Y);

   if (result.ChartElement == ChartElement.DataPoint)
   {
    double value = (double)(((NSeries)result.Series).Values[result.DataPointIndex]);
    textBox1.Text = "Data Point [" + result.DataPointIndex.ToString() + "], Value [" + value.ToString() + "]";
   }
  }

it shows how to perform hit test and get the data point value when you click on it. Hope this helps - let us know if you meet any problems.



Best Regards,
Nevron Support Team


Alexander Sorich
Alexander Sorich
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)
Group: Forum Members
Posts: 9, Visits: 1
Hello Nevron Support Team,
Thankyou very much for Your help! I can implement the method with MouseDown
and use the information in my software now.
I've a question to the chart.
If I'm creating the
NsmoothLineSeries,
NsmoothAreaSeries,
NbarSeries,
NpolarLineSeries,
NpolarPointSeries,
NpieSeries,
NradarLineSeries or
NradarAreaSeries,
then it is possible to show the datapoints.
If i'm creating a
NareaSeries,
NpolarAreaSeries or
NlineSeries,
i always get the [0] Element to show after mouse click.
It is possible to remove this error ?

Best Regards,
Alexander

p.s.
I have got added an reply of MouseMovie. I have the same problem in MouseMovie too.
If I take the mouse over the datapoint from
NareaSeries,
NpolarAreaSeries or
NlineSeries,
i get the [0] Element to show after mouse click too.
by the another N...Seies Types this problem does not appear.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search