PHP/CSS bar chart with large numbers

Viewed 59

I want to make a bar chart using PHP and CSS (DIVs with different heights). I know how to do the chart, it works fine.

But the problem is: the array of numbers I have is in the range between 65000 and 60000. The outcome is that the bars in the 65k's look like one step, and the bars in the 60k to 61k range look like they are all on the same level. With a graph height of 280 pixel, there is almost no visible difference. I want to be able to "zoom" into the important part of the chart.

I can't seem to come up with solution for how to ignore the large bottom portion, and just show the bar chart with the lowest number (60330) at the bottom of the chart and the largest number (65050) at the top of the chart. For example, just like stock graphs show the lowest price and the highest price within a certain date range, but never the entire amount up from $0 crammed into a 200 pixel high chart.

I keep thinking of percentage or ratio between lowest and highest, but that's as far as I get before I my brain goes blank.

I hope somebody can point me in the right direction.

1 Answers

I used JMPs suggestion and tweaked a bit for the ratio and I got something I can work with.

`$truncated_max = $maxVal - $minVal;

$ratio=$graph_height/$truncated_max;

$value = $value - $minVal + 50;`

enter image description here

Related