Programming problem: determining the tick marks in a graphing program

flashbacck

Golden Member
Aug 3, 2001
1,921
0
76
I'm writing a java applet that graphs some data, and I'm having a hard time determining the best way to draw the tick marks on the axes. I know I could use someone's graphing library, but there are some special things I need to do in this graph, and I'm also too lazy to read through other's documentation.

One effort I tried is below. This example also isn't set up to draw minor tick marks, which I want.
mzmax and mzmin are the max and min x axis positions in data pt values.
xend is the end of the graphing space in panel coordinates
convertmztox converts the datapt into pixel position

any suggestions appreciated,
thanks.
edit: corrected mzmax and mzmin definitions
 

flashbacck

Golden Member
Aug 3, 2001
1,921
0
76
A second effort, that works. I think. Anyway, I've attached it below on the off chance that someone someday will want similar code.
 

Cooler

Diamond Member
Mar 31, 2005
3,835
0
0
I use to have a peice of scaling graph code which would scale data based on size of graph bounds. if i find it i may post it later.