Download QCChart2D User Manual - Quinn

Transcript
398 File and Printer Rendering
stockPriceData[0, 0] = 25;
stockPriceData[1, 0] = 26;
stockPriceData[2, 0] = 24;
// open
// high
// low
for (i = 1; i < nNumPnts; i++)
{
xValues[i] = (ChartCalendar)currentdate.Clone();
stockPriceData[3, i] += stockPriceData[3, i - 1] + 3 * (0.52 ChartSupport.GetRandomDouble()); // close
stockPriceData[0, i] += stockPriceData[3, i] + 2 * (0.5 ChartSupport.GetRandomDouble()); // open
minval = Math.Min(stockPriceData[3, i], stockPriceData[0, i]);
maxval = Math.Max(stockPriceData[3, i], stockPriceData[0, i]);
stockPriceData[1, i] = maxval + 1.5 *
ChartSupport.GetRandomDouble(); // high
stockPriceData[2, i] = minval - 1.5 *
ChartSupport.GetRandomDouble(); // low
currentdate = ChartCalendar.CalendarDaysAdd(currentdate, 1,
weekmode);
}
TimeGroupDataset Dataset1 = new TimeGroupDataset("Stock Data",
xValues, stockPriceData);
int[] compressarray = new int[4];
compressarray[0] = ChartObj.DATACOMPRESS_AVERAGE;
compressarray[1] = ChartObj.DATACOMPRESS_MAX;
compressarray[2] = ChartObj.DATACOMPRESS_MIN;
compressarray[3] = ChartObj.DATACOMPRESS_AVERAGE;
TimeCoordinates pTransform1 = new TimeCoordinates();
pTransform1.SetWeekType(ChartObj.WEEK_5D);
pTransform1.AutoScale(Dataset1, ChartObj.AUTOAXES_NEAR,
ChartObj.AUTOAXES_NEAR);
pTransform1.SetGraphBorderDiagonal(0.13, .15, .90, 0.8);
Background graphbackground1 = new Background(pTransform1,
ChartObj.GRAPH_BACKGROUND,
Color.FromArgb(127, 127, 127), Color.FromArgb(55, 55, 55),
ChartObj.Y_AXIS);
chartVu.AddChartObject(graphbackground1);
Background plotbackground1 = new Background(pTransform1,
ChartObj.PLOT_BACKGROUND,
Color.White);
chartVu.AddChartObject(plotbackground1);
TimeAxis xAxis1 = new TimeAxis(pTransform1);
xAxis1.SetColor(Color.White);
chartVu.AddChartObject(xAxis1);
LinearAxis yAxis1 = new LinearAxis(pTransform1, ChartObj.Y_AXIS);
yAxis1.SetColor(Color.White);
chartVu.AddChartObject(yAxis1);
TimeAxisLabels xAxisLab1 = new TimeAxisLabels(xAxis1);
xAxisLab1.SetColor(Color.White);
chartVu.AddChartObject(xAxisLab1);
NumericAxisLabels yAxisLab1 = new NumericAxisLabels(yAxis1);
yAxisLab1.SetAxisLabelsFormat(ChartObj.CURRENCYFORMAT);
yAxisLab1.SetColor(Color.White);
chartVu.AddChartObject(yAxisLab1);
Grid xgrid1 = new Grid(xAxis1, yAxis1, ChartObj.X_AXIS,
ChartObj.GRID_MAJOR);
xgrid1.SetColor(Color.Black);
chartVu.AddChartObject(xgrid1);
Grid xgrid2 = new Grid(xAxis1, yAxis1, ChartObj.X_AXIS,
ChartObj.GRID_MINOR);
xgrid2.SetColor(Color.Gray);
chartVu.AddChartObject(xgrid2);