1. Graph question?

Hello everybody,

I have a graph 260 pixels long.

Top pixel 5, Bottom pixel 265.

I want to display amounts on the graph from low 1.25847 to high 1.25863.

What would be the formula to convert from amount to pixel?

Don Cole

new topic     » topic index » view message » categorize

2. Re: Graph question?

DonCCole said...

Top pixel 5, Bottom pixel 265.

I want to display amounts on the graph from low 1.25847 to high 1.25863.

What would be the formula to convert from amount to pixel?

I assume you want the Y axis values.

Try this...

MinVal = 1.25847 
MaxVal = 1.25863 
MinY = 5 
MaxY = 265 
TickRatio = ((MaxVal - MinVal) / (MaxY - MinY)) 
 
Y = floor(MaxY - (Value - MinVal)/TickRatio) 
new topic     » goto parent     » topic index » view message » categorize

3. Re: Graph question?

DerekParnell said...
DonCCole said...

Top pixel 5, Bottom pixel 265.

I want to display amounts on the graph from low 1.25847 to high 1.25863.

What would be the formula to convert from amount to pixel?

I assume you want the Y axis values.

Try this...

MinVal = 1.25847 
MaxVal = 1.25863 
MinY = 5 
MaxY = 265 
TickRatio = ((MaxVal - MinVal) / (MaxY - MinY)) 
 
Y = floor(MaxY - (Value - MinVal)/TickRatio) 

Thank you Derek,

Yes I only am doing the Y axis on this graph.

This code works great.

Don Cole

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu