Page 1 of 1

Drag PointLineSeries

Posted: Mon Jan 26, 2015 8:39 am
by vifani
Is it possible to drag a pointLineSeries with mouse on the X axis to apply an offset to the points?

Re: Drag PointLineSeries

Posted: Mon Jan 26, 2015 11:35 pm
by ArctionPasi
Not directly, but via event handlers...

In series.MouseDown or equivalent event handler you can get the original y axis value by using
YAxis.CoordToValue to y1.

In chart.MouseUp event handler, you can get the Y coordinate with the same method as y2.

Now you now the yDelta = (y2 - y1). Loop through the data points of the series, and add that yDelta to each point Y value. Then call series.InvalidateData().

That should work. :?

Re: Drag PointLineSeries

Posted: Tue Jan 27, 2015 11:11 am
by vifani
The problem is that my PointLineSeries have millions of points. Apply the offset for each point is too expensive.
Is there a way to apply an offset to the entire series? (the mouse interaction is not fundamental)

Re: Drag PointLineSeries

Posted: Tue Jan 27, 2015 11:23 am
by ArctionPasi
Can you use SampleDataSeries? There' AddOffsetToSamples method.

Alternatively, adjust the Y axis range and manipulate with the labels. For example, using CustomTicks.