|
How to......add it... |
Posted by JJJ on Sep-08-2011 17:22 |
|
Hi~Peter
how to do...
code
Peter int noOfPoints = 273;
RanTable rantable = new RanTable(9, 1, 85);
// Set the 1st column to start with 1800 and with random delta from -5 to 5.
rantable.setCol(0, 1800, -5, 5);
// Get the data as the 1st column of the random table
double[] data = rantable.getCol(0);
// The x-axis labels for the chart
string[] labels = { "9", "-", "10", "-", "11", "-", "12", "-", "13", "-" };
//
// Now we obtain the data into arrays, we can start to draw the chart using
// ChartDirector
//
// Create a XYChart object of size 180 x 180 pixels with a blue background
// (0x9c9cce)
XYChart b = new XYChart(320, 200); //尺寸
XYChart bb = new XYChart(320, 100); //尺寸
MultiChart c = new MultiChart(327, 190);
c.addChart(1, 0, b);//B
c.addChart(2, 140, bb);//B
// Add titles to the top and bottom of the chart using 7.5pt Arial font. The text
// is white 0xffffff on a deep blue 0x31319C background.
//c.addTitle2(Chart.Top, "STAR TECH INDEX 2003-01-28", "Arial", 7.5, 0xffffff,0x31319c);
//c.addTitle2(Chart.Bottom, "LATEST STI:1809.41 (+14.51)", "Arial", 7.5, 0xffffff,0x31319c);
// Set the plotarea at (31, 21) and of size 145 x 124 pixels, with a pale yellow
// (0xffffc8) background.
b.setPlotArea(40, 30, 270, 100);
bb.setPlotArea(40, 5, 270, 30);
//b.addBarLayer(data_oo, 0x7f6666ff).setBorderColor(Chart.Transparent, 0);
// Add custom text at (176, 21) (top right corner of plotarea) using 11pt Times
// Bold Italic font/red (0xc09090) color
//c.addText(176, 21, "Chart Demo", "Times New Roman Bold Italic", 11, 0xc09090).setAlignment(Chart.TopRight);
c.addText(8, 0, "2222222", "", 8, 0xffffff).setBackground(0x000000);
// Use 7.5 pts Arial as the y axis label font
// Set the labels on the x axis by spreading the labels evenly between the first
// point (index = 0) and the last point (index = noOfPoints - 1)
bb.xAxis().setLinearScale(0, noOfPoints - 1, labels);
b.xAxis().setLinearScale(0, noOfPoints - 1, labels);
//b.yAxis().setLabelStyle("", 7.5, Chart.Transparent);
//bb.yAxis().setLabelStyle("", 7.5, Chart.Transparent);
// Use 7.5 pts Arial as the x axis label font
b.xAxis().setLabelStyle("", 7.5, Chart.Transparent);
// Add a deep blue (0x000080) line layer to the chart
b.addLineLayer(data_yycc, 0xff0000);
b.addLineLayer(data_cc, 0x0000ff);
bb.addBarLayer(data_vv, 0xff0000).setBorderColor(Chart.Transparent, 0);
//c.yAxis().setAutoScale(0, 0);
// Output the chart
//WebChartViewer1.Image = c.makeWebImage(Chart.PNG);
string query1 = c.makeTmpFile(Server.MapPath("../tmp_img"));
|
Re: How to......add it... |
Posted by Peter Kwan on Sep-08-2011 18:11 |
|
Hi JJJ,
You may enable vertical grid lines when you call setPlotArea. For example:
//b.setPlotArea(40, 30, 270, 100);
//transparent background colors, black 0x00000 edge, grey 0xcccccc horizontal grid
//lines, green 0x00ff00 vertical grid lines
b.setPlotArea(40, 30, 270, 100, Chart.Transparent, Chart.Transparent, 0x000000, 0xcccccc, 0x00ff00);
Hope this can help.
Regards
Peter Kwan |
Re: How to......add it... |
Posted by JJJ on Sep-16-2011 11:16 |
|
Thank you. |
|