We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Drag-and-drop series points with mouse movement

Hi,

I need to draw a chart with mouse movement, I'm using the following example (see attached file) but the chart is limited to about 100 points (after that the chart become laggy and slow).

Is it possible to draw a chart using mouse movement with SfChart? 

If so, is it possible to draw a chart of about a million points? kind like an EKG chart?

Any help or a sample code would be highly appreciated,

Regards,

Dov. 

Attachment: Drag_Drop_Datapoints_868ea286.zip

7 Replies

SA Santhiya Arulsamy Syncfusion Team January 5, 2016 04:10 PM UTC

Hi Dov,

Thanks for your update.

Please find the response of your queries.

Query: Is it possible to draw a chart using mouse movement with SfChart?  

Yes, it is possible to draw a chart using the mouse movement in SfChart. In your attached sample we have achieved the requirement by using the work around sample. In SfChart, we have the direct support of “Visual Data Editing “for LineSeries. We have prepared the simple sample for your reference. Please find the sample from the following location.

Sample:VisualDataEditing

Please refer to the following UG link of SfChart for further information.

https://help.syncfusion.com/wpf/sfchart/interactive-features#visual-data-editing

Query:  Is it possible to draw a chart of about a million points?

Yes, it is possible to draw a chart with million points using the FastLineSeries in SfChart. We have prepared the sample for your reference. Please find the sample from the following location.

Sample: Sample_121575

 
Please refer to the following UG link of SfChart for further information.
 https://help.syncfusion.com/wpf/sfchart/series#fastlineseries
 
Thanks,

Santhiya A




DO Dov January 6, 2016 10:23 AM UTC

Thank you for your fast reply.

I'm not sure if I'm missing something or doing something wrong.

I understand that I need to use the "EnableSegmentDragging" in order to move each point but it seems that I can't add it to a mouseMove event.

Also, how can I use both VisualDataEditing and FastLineSeries in the same SfChart?

My intent is to let the user to draw a chart from scratch with mouse down and mouse move events for as long as he presses the mouse button),
and that he could choose the number of points of the chart and that it won't become laggy and less responsive if he chooses 1000 points instead of 100.

Regards,

Dov.


SA Santhiya Arulsamy Syncfusion Team January 7, 2016 04:38 PM UTC

Hi Dov,

Thanks for your update.

We have prepared a workaround sample based on your requirement. We would like to inform you that VisualDataEditing feature is only available for ColumnSeries, LineSeries, SplineSeries, BarSeries and RangeColumnSeries. Please find the sample from the following location.

Sample:DragDropSample

Thanks,

Santhiya A



DO Dov March 9, 2016 03:02 PM UTC

Hi,

I'm still having some difficulties with my chart.

I've created a sample application that demonstrate my problem.

If I choose to draw a chart of 100 points - drag and drop works great, but if I set the number of points to 1024 (for example) then drag and drop not working smoothly and you can see spikes between two overlapping points.

I want my application to allow the user to select even bigger number of points (up to a million) drag and drop needs to run smoothly without those spikes between two overlapping points and without using of a scroll bar to view all the points on the chart - all points must be displayed on the chart.

I guess that I'll probably won't be able to draw a chart of a million points and view all of them at once in a way that would look reasonably (like I'm viewing a chart of 100 points)  so I'll need to convert points from the maximum points I can draw on a chart to a million, I just need to find that maximum value of points that I can draw.

Is there any way to make the chart of 1024 points to work like the 100 points? (Or maybe even with a bigger number of points?)

I really appreciate all the help.

Regards,

Dov.


Attachment: sfchart_8f8dfebb.rar


SJ Sumathi Jayaraj Syncfusion Team March 10, 2016 12:54 PM UTC

Hi Dov,

As you have observed, some intermediate points are skipped in mouse move and that points are not updated in chart.

For 100 points, the interval between each points is higher compare with the interval when we are having 1000 (or even more) points. So small changes in mouse move might leads to cross(or skip) one or two points.
You can resolve this by zooming the chart only.

Also could you please provide more information about your end level requirement in chart, so that we can suggest some other feasible solutions.

Regards,
Sumathi J


DO Dov March 16, 2016 01:44 PM UTC

Thank you for your reply.

I've managed to fix my issue, I'll write my solution here in case it will help any other users who come across this thread.

First time MouseMove event fire I'll add the current Point (pt) to the chart and then I'll save pt as a previous Point (prevPt), XMval as prevXMval and YMval as prevYMval.

Then, any time MouseMove event fire I'll use linear interpolation to add points as a compensation for the points that were skipped during mouse movement.
For example if first event fire at (1,3) and second event fire at (5,10) then I'm adding 3 points to the chart: (2, linear interpolation result), (3, linear interpolation result), (4, linear interpolation result).


// add current pt to the chart
mod.measurments[Convert.ToInt32( XMval )].Y = YMval;

if( prevPt != pt )
{

    if( prevXMval < XMval )
    {
     // mouse move left (current x value is bigger then previous value)

        for( UInt32 i = prevXMval; i < XMval; i++ )
        {
            // linear interpolation return new y value (for current i), that point will be added to the chart
            mod.measurments[Convert.ToInt32( i )].Y = Convert.ToUInt32( linear( i, prevXMval, XMval, prevYMval, YMval ) );
        }
    }
    else if( prevXMval > XMval )
    {
     // mouse move right (current x value is smaller then previous value)

        for( UInt32 i = XMval; i < prevXMval; i++ )
        {
            // linear interpolation return new y value (for current i), that point will be added to the chart
            mod.measurments[Convert.ToInt32( i )].Y = Convert.ToUInt32( linear( i, prevXMval, XMval, prevYMval, YMval ) );
        }
    }

}
// update prev data
prevPt = pt;
prevXMval = XMval;
prevYMval = YMval;

 

That basically fix the problem, now I can draw up to 15K points without any smoothness issues or spikes.

Regards,

Dov.
 


SJ Sumathi Jayaraj Syncfusion Team March 17, 2016 04:50 AM UTC

Hi Dov,

Thanks for the update.

Please let us know if you have any queries.

Regards,
Sumathi J

Loader.
Live Chat Icon For mobile
Up arrow icon