Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Java
 QCChart2D for Java
 Setting the x-axis items at the bottom...
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

javaman

22 Posts

Posted - 14 May 2009 :  14:11:02  Show Profile  Reply with Quote
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!

quinncurtis

1164 Posts

Posted - 14 May 2009 :  16:38:50  Show Profile  Reply with Quote
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);
Go to Top of Page

javaman

22 Posts

Posted - 26 May 2009 :  19:48:53  Show Profile  Reply with Quote
Thank you! That worked beautifully!
Joe...

Thanx - Joe!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07