Juliyanage Silva
Juliyanage Silva

Reputation: 2699

how to shorten the numeric ticks on axises

Hi I'm using jqplot and is there a way to shorten the tick labels on numeric axis. Suppose there is a y series like this [100,250,125000000,14000000,300,..]. here according to the biggest values axis is scaled and rendered with large tick values. I want to simplify this ticks to millions or billions rendered with mill or bill with the axis. Any ideas?

Thanks in advance.

Upvotes: 2

Views: 2239

Answers (1)

ButterDog
ButterDog

Reputation: 5225

I use this on my initialization, pay attention at the "formatString" option, ".2F" means that the number (a float) will be rounded after the 2nd decimal (####.##), it's just a matter of finding the right format string you need.

Plot = $j.jqplot('divPerformancePlot',[Data],{
    title: Title,
    axes: {
        xaxis: {
            renderer: $j.jqplot.DateAxisRenderer,
            tickOptions: {
                formatString: '%b %#d, %T'
            },
            numberTicks: 4
        },
        yaxis: {
            tickOptions: {
                formatString: '%.2f '
            }
        }
    },
    highlighter: {
        sizeAdjust: 10,
        show: true,
        tooltipLocation: 'n',
        useAxesFormatters: true
    },
    cursor: {
        show: true,
        zoom: true
    }
});

Upvotes: 3

Related Questions