Author |
Topic  |
|
ram
1 Posts |
Posted - 02 Dec 2003 : 11:33:43
|
Is there an example that uses time on x-axis that falls between two dates. For example shift production tracking between 6.00 PM to 6.00 AM, X-axis would be time and y-axis would be weight in tons.
Thanks |
|
quinncurtis
1164 Posts |
Posted - 02 Dec 2003 : 16:12:15
|
You can modify starting time of the ScatterPoints.c chart in the ChartTabDemo example to produce a graph like the one you want. See the "// ***" lines. If you define the x-values to cross a day boundary, the auto-scale methods automatically take this into account
int numPoints = 20; ChartCalendar []x1 = new ChartCalendar[numPoints]; double []y1 = new double[numPoints]; double []y2 = new double[numPoints]; int i; double z;
ChartCalendar currentDate = new ChartCalendar();
// *** This is the only line that changes in the ScatterPoints example // *** Set the starting time of 6:00:00 PM ChartCalendar.SetTOD(currentDate,18,0,0);
// Define 20 points, equals 10 hours worth of data for (i=0; i < numPoints; i++) { z = (double) i - 10.0; x1[i] = (ChartCalendar) currentDate.Clone(); y2[i] = . . . currentDate.Add (ChartCalendar.MINUTE,30); }
TimeSimpleDataset Dataset1 = new TimeSimpleDataset("First",x1,y1); TimeSimpleDataset Dataset2 = new TimeSimpleDataset("Second",x1,y2);
TimeCoordinates pTransform1 = new TimeCoordinates( ChartObj.TIME_SCALE, ChartObj.LINEAR_SCALE); pTransform1.AutoScale(Dataset1, ChartObj.AUTOAXES_FAR, ChartObj.AUTOAXES_FAR);
|
 |
|
|
Topic  |
|
|
|