Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VISIBLOX, WPF: Getting chart points to scroll horizontally?

I'm using the Visiblox WPF API and am having trouble getting the chart points in my line chart to scroll horizontally. Instead of scrolling, the points are get squashed together, in which, this isn't particularly a problem, except that I expect to have 100s of data points on the chart. I have looked throughout the examples available on the Visiblox website, but couldn't find what I was looking for. Ive attached an example screenshot.

Any ideas?

Thanks for your help, Sparky

Example

like image 919
Sparky Avatar asked Apr 05 '11 15:04

Sparky


2 Answers

By default Visiblox Charts will re-calculate the range to include all the data in the series, so there are two possible approaches: 1) when you add the last point, remove the first one which will effectively move the visible window one point over or 2) set an explicit axis range and update that when you want to move the visible window.

Check out the Visiblox blog for more details on how ranges work at: http://www.visiblox.com/blog/2011/03/visiblox-charts-ranges-demystified

like image 62
wjbeau Avatar answered Oct 23 '22 13:10

wjbeau


I just had something like this recently. Everytime I'd add a point to the cart I'd run a little section of code that would check the amount of time (my x-axis dimension) that had passed since 0. I also set up a range of data I always wanted to see. I always wanted to show 120 seconds of data on the graph. So I had something like this:

private void adjustXasis(int timeCount)
{
    if(timeCount>desiredRange)
    {
        chart.axis.Xaxis.minimum=timeCount-desiredRange;
        chart.axis.Xaxis.maximum=timeCount;
    }
    else //two minutes not reached yet
    {
        chart.axis.Xaxis.minimum=0;
        chart.axis.Xaxis.maximum=desiredRange;
    }           
}

I don't have VS in front of me and I know that syntax for the axis min/max is wrong but you get the idea.

like image 22
Brad Avatar answered Oct 23 '22 13:10

Brad