ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  ViewportcontroldemoController with unlimited data
Posted by mark on Feb-20-2018 14:38

Dear Support,

I have modified ViewportcontroldemoController demo basically to display some readings from a machine. I have created a list to hold all the data from the machine in realtime mode. This list basically doesnt have a limit and all depend on system memory on the amount of the data that the list can hold.  My chart has a fixed 1500 seconds view hence i have put the below in initviewer. Everything works fine except when the chart refreshes . The problem starts when there is new data comes in. i have included the below code in my function that loads new data as well basically to update the size of viewport.

            viewer.ViewPortWidth = (1500.0 + 0) / dtmTimeStamps.Count;
            viewer.ViewPortLeft = 1 - viewer.ViewPortWidth;

since the above code sets the viewportleft to the most right everytime, it basically prevents me from scrolling the the viewport to left. Could you assist me in achieving the below:

1.) the ViewPortWidth should be auto sized based on the the fixed view 1500seconds and the size of the list which holds the complete data from machine.
2.)Viewport should always shows the latest 1500 seconds data from the list. - which currently showing.
3.)Viewportleft shouldn't goes to the most right i scroll the viewport. resizing viewportwidth is fine
4.) When user adjust the viewportleft to the most right the chart should hooked back and shows automatically the most 1500seconds data thereafter.
5.)The system disable users from adjusting the ViewPortWidth manually with mouse.

Thanks and Regards
Mark

  Re: ViewportcontroldemoController with unlimited data
Posted by mark on Feb-20-2018 14:45
3.)when user scroll the viewport, the viewportleft should remain at the place that users wanted  . resizing viewportwidth based on incoming new data is fine
4.) When user adjust the viewportleft to the most right the chart should hooked back and shows automatically the most 1500seconds data without any futher scrolling thereafter.
5.)The system should disable users from adjusting the ViewPortWidth manually with mouse.

  Re: ViewportcontroldemoController with unlimited data
Posted by Peter Kwan on Feb-20-2018 18:02
Hi mark,

Please try the "Real-Time Chart with Viewport Control" sample code to see if it is substantially what you need.

http://www.advsofteng.com/tutorials/extra.html

http://www.advsofteng.com/gallery_realtimeviewport.html

I think it meets most of your requirements except not allowing zooming. To disable zooming, please do the follows:

(1) Remove the Zoom In/Out buttons on the left, so the user cannot use the mouse to Zoom In/Out by dragging/clicking on the chart.

(2) Remove the line that calls setMouseWheelZoomRatio, so that mouse wheel zooming is not enabled.

(3) Set WPFViewPortControl.DragBorderToResize and WPFViewPortControl.DragOutsideToSelect to false, so that the user cannot resize the viewport and cannot drag a new viewport. This means user can only move the existing viewport.

http://www.advsofteng.com/doc/cdnet.htm#WPFViewPortControl.DragBorderToResize.htm

http://www.advsofteng.com/doc/cdnet.htm#WPFViewPortControl.DragOutsideToSelect.htm

Hope this can help.

Regards
Peter Kwan

  Re: ViewportcontroldemoController with unlimited data
Posted by mark on Apr-03-2018 10:53
Hi,

Do you have the same example for web version ?

I am thinking of disabling the below code for few seconds while scrolling.

Please advise

thanks
mark

  Re: ViewportcontroldemoController with unlimited data
Posted by Peter Kwan on Apr-04-2018 02:39
Hi mark,

I can develop an example for you. Just to confirm, are you using ASP.NET with C# or are you using other programming language (eg. PHP) or web framework (eg. ASP.NET MVC)?

Regards
Peter Kwan

  Re: ViewportcontroldemoController with unlimited data
Posted by mark on Apr-04-2018 23:05
hi i am developing a web application with MVC + C#, preferably the demo that you will develop will able to do exactly what your .net client application can do such as auto scrolling when there is new feed, viewport freezes a moment(for a preset time), when we scroll the chart.  and etc.

thanks
mark

  Re: ViewportcontroldemoController with unlimited data
Posted by mark on Apr-04-2018 23:08
yes its ASP.NET with C#
tq

  Re: ViewportcontroldemoController with unlimited data
Posted by Peter Kwan on Apr-05-2018 23:27
Attachments:
Hi mark,

From your message, I assume you are using ASP.NET MVC  (as opposed to ASP.NET Web Forms). I have attached the ASP.NET MVC version of the Realtime Chart with Viewport Control sample code in C# for your reference.

Regarding the "viewport freezes a moment (for a preset time) when we scroll the chart", if you need this feature, you may add the following Javascript code to disable the RazorViewPortControl when the chart is updating.

    //
    // Insert the following code after the existing viewer.attachHandler line
    //

    var vpCtrl = JsViewPortControl.get('@ViewBag.ViewPortControl.ID');

    // disables the viewport control before the update
    viewer.attachHandler("PreUpdate", function () {
        vpCtrl.setDragInsideToMove(false);
        vpCtrl.setDragBorderToResize(false);
        vpCtrl.setDragOutsideToSelect(false);
        vpCtrl.setClickToCenter(false);
    });

    // re-enables the viewport control after the update
    viewer.attachHandler(["PostUpdate", "UpdateError"], function () {
        vpCtrl.setDragInsideToMove(true);
        vpCtrl.setDragBorderToResize(true);
        vpCtrl.setDragOutsideToSelect(true);
        vpCtrl.setClickToCenter(true);
    });

Regards
Peter Kwan
ViewportcontroldemoController.cs
ViewportcontroldemoController.cs

10.31 Kb
Index.cshtml
Index.cshtml

10.14 Kb