posted 10 years ago
I have created a bar chart along x axis. I need to label the x axis with the provided min, max numbers. For ex: if [min,max] are [0, 1000] and 5 ticks. suppose the width of the chart is 500 px. So i would have to arrange 0,200,400,600,800,1000 in 500 px width. But if the [min,max] changes, example [0,100], 5 ticks, 500 px width, the alignment and spacing between the labels should be appropriate. I have seen many javascipt codes, but they they are very long with many features and it was difficult to segregate the part i need, that is just to space the labes labels based on [min,max], number of labels and width of chart.
could anyone provide the javascript for creating labels when the width of chart, min and max points, number of labels on chart are provided.(no jquery)