Custom Tick Labels
Custom Tick Labels
I have a chart created from a TimeSeries, with dates on the x-axis, and integers on the y-axis, and I want to be able to specify arbitrary tick labels for certain y-values. For example, at the point where y=1200, I want a tick with label "1k", and at y=1300, I want a tick with label "1d". How can I do this?
Code: Select all
org.jfree.chart.axis.SymbolAxis
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
SymbolAxis might be a little restrictive, since it assumes integer values 0, 1, 2, ...
Another option would be to subclass the NumberAxis class and override the refreshTicks() method.
Another option would be to subclass the NumberAxis class and override the refreshTicks() method.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Custom Y axis Label
Dear all,
I did a drawing of volume chart, and my volume data is very large. i.e like 345566 to 2332223. and i need to display the volume data in y axis as like
345K and 2.3M.
my code is
private DefaultCategoryDataset methodForVolume(Object[][] _result) {
dataset.clear();
int length = _result.length;
//double[] s_Last = new double[length];
double[] volume = new double[length];
double[] open = new double[length];
double[] close = new double[length];
for(int i=0; i<_result.length;i++) {
Date e_Date = (Date) _result[0];
open = ((Float) _result[2]).doubleValue();
close =((Float) _result[5]).doubleValue();
volume =((Long) _result[6]).doubleValue();
if(volume>0 && volume<999999)
volume=(volume[i]/1000);
if(volume[i]>999999 && volume[i]<99999999)
volume[i]=(volume[i]/10000);
dataset.addValue(volume[i],"",new Millisecond(0,e_Date.getSeconds(),e_Date.getMinutes(),e_Date.getHours(),e_Date.getDate(),e_Date.getMonth()+1,e_Date.getYear()+1900));
// dataset.addValue(volume[i],"",new Millisecond(0,e_Date.getSeconds(),e_Date.getMinutes(),e_Date.getHours(),e_Date.getDay(),e_Date.getMonth()+1,e_Date.getYear()+1900));
}
chartForBar = ChartFactory.createBarChart(null," ",null,dataset,PlotOrientation.VERTICAL,true,true,false);
Note :- PLease help me how i can change the Y axis value
Thanks
I did a drawing of volume chart, and my volume data is very large. i.e like 345566 to 2332223. and i need to display the volume data in y axis as like
345K and 2.3M.
my code is
private DefaultCategoryDataset methodForVolume(Object[][] _result) {
dataset.clear();
int length = _result.length;
//double[] s_Last = new double[length];
double[] volume = new double[length];
double[] open = new double[length];
double[] close = new double[length];
for(int i=0; i<_result.length;i++) {
Date e_Date = (Date) _result[0];
open = ((Float) _result[2]).doubleValue();
close =((Float) _result[5]).doubleValue();
volume =((Long) _result[6]).doubleValue();
if(volume>0 && volume<999999)
volume=(volume[i]/1000);
if(volume[i]>999999 && volume[i]<99999999)
volume[i]=(volume[i]/10000);
dataset.addValue(volume[i],"",new Millisecond(0,e_Date.getSeconds(),e_Date.getMinutes(),e_Date.getHours(),e_Date.getDate(),e_Date.getMonth()+1,e_Date.getYear()+1900));
// dataset.addValue(volume[i],"",new Millisecond(0,e_Date.getSeconds(),e_Date.getMinutes(),e_Date.getHours(),e_Date.getDay(),e_Date.getMonth()+1,e_Date.getYear()+1900));
}
chartForBar = ChartFactory.createBarChart(null," ",null,dataset,PlotOrientation.VERTICAL,true,true,false);
Note :- PLease help me how i can change the Y axis value
Thanks