Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
javaman
Posted - 14 May 2009 : 14:11:02 Hi,
Right now, I have a time series plot (Y value ranges from 0 to 10000 and X is the time value). So, the x-axis displays the time value at certain intervals. Is it possible to set what the x-axis displays? Right now, the x-axis displays a HH:MM:SS format. I'd like to change that to display the day of year such that is becomes DDD/HH:MM:SS. Is this possible - how can I do this?
Here's my code:
xAxis1 = new TimeAxis(pTransform1); xAxis1.setColor(Color.white); gWG.addChartObject(xAxis1);
yAxis1 = new LinearAxis(pTransform1, ChartConstants.Y_AXIS); yAxis1.setColor(Color.white); gWG.addChartObject(yAxis1);
xAxisLab1 = new TimeAxisLabels(xAxis1); xAxisLab1.setColor(Color.white); gWG.addChartObject(xAxisLab1);
Thanx - Joe!
2 L A T E S T R E P L I E S (Newest First)
javaman
Posted - 26 May 2009 : 19:48:53 Thank you! That worked beautifully! Joe...
Thanx - Joe!
quinncurtis
Posted - 14 May 2009 : 16:38:50 You can customize the TimeAxisLabels format following the rules of the Java SimpleDateFormat class.
Use the string you show with the setCustomTimeFormatString method. The example below also turns off the date crossover, which you probably don't want.
TimeAxisLabels xAxisLab = new TimeAxisLabels(xAxis); xAxisLab.setTextFont(theFont); xAxisLab.setCustomTimeFormatString("DDD/HH:mm"); xAxisLab.setDateCrossoverMode(ChartObj.NO_DATECROSSOVER);