Welcome Guest Search | Active Topics |

Minimum range for graph?
AndyBryson
#1 Posted : Wednesday, January 15, 2014 10:27:08 AM(UTC)
Rank: Newbie

Groups: ExpiredLicense, Registered
Joined: 4/17/2013(UTC)
Posts: 3

Thanks: 2 times
Was thanked: 0 time(s) in 0 post(s)
Is there a way to set a minimum difference between the maximum and minimum value in a linear axis?

E.g. I want to be able to display numbers from 0 to 1000 and for them to fill the chart. I also want 0-50 to fill the chart, but numbers between 5 and 5.5 should look roughly the same, minimum should be something ~0, and maximum ~10.

Possible?

Thanks
Dragan
#2 Posted : Thursday, January 16, 2014 6:31:45 AM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
I'm not really sure I understand your requirement.

Here is an example how you can set minimum and maximum of an axis:
http://www.jqchart.com/jquery/chart/ChartAxes/LinearAxis
Best Regards,
Dragan Matek
jqChart Inc.
AndyBryson
#3 Posted : Thursday, January 16, 2014 8:16:01 AM(UTC)
Rank: Newbie

Groups: ExpiredLicense, Registered
Joined: 4/17/2013(UTC)
Posts: 3

Thanks: 2 times
Was thanked: 0 time(s) in 0 post(s)
Sorry, I was unclear. Let me try again...

I would like to keep dynamic axis range, so that it can expand and contract around the points, but I'd like to be able to set a minimum difference between minimum and maximum, so that it doesn't automatically zoom in too far.

Something like this in pseudo code...
Code:
min = dataArray[0];
max = dataArray[0];
minimumDifference = 10;

// get min and max from data series
for each point in dataArray
{
    if( point < min )
        min = point;
    if( point > max )
        max = point;   
}

// pad the axis so that the range isn't too small
diff = max - min;
if( diff < minimumDifference )
{
    min -= ( ( minimumDiffence - diff ) / 2 )
    max += ( ( minimumDiffence - diff ) / 2 )
}

// set value in graph
axis.min = min;
axis.max = max;
Dragan
#4 Posted : Thursday, January 16, 2014 9:10:36 AM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
I've sent you a version, which supports this functionality via email. We'll try including this feature in the next official release as well.
Best Regards,
Dragan Matek
jqChart Inc.
1 user thanked Dragan for this useful post.
AndyBryson on 1/16/2014(UTC)
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

FlatEarth Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.095 seconds.