// // Create chart // private void createChart(RazorChartViewer viewer) { // The data for the area chart double[] data = { 30, 28, 40, 55, 75, 68, 54, 60, 50, 62, 75, 65, 75, 89, 60, 55, 53, 35, 50, 66, 56, 48, 52, 65, 62 }; // The labels for the area chart string[] labels = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24" }; // Create a XYChart object of size 250 x 250 pixels XYChart c = new XYChart(250, 250); // Set the plotarea at (30, 20) and of size 200 x 200 pixels c.setPlotArea(30, 20, 200, 200); // Add an area chart layer using the given data c.addAreaLayer(data); // Set the labels on the x axis. c.xAxis().setLabels(labels); // Display 1 out of 3 labels on the x-axis. c.xAxis().setLabelStep(3); // Output the chart viewer.Image = c.makeWebImage(Chart.PNG); // Include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("", "", "title='Hour {xLabel}: Traffic {value} GBytes'"); }
public void createChartWeight(WebChartViewer Wviewer, Double[] Weight, Double[] BMI, DateTime[] YearWeightBMI) { XYChart c = new XYChart(900, 570, 0xddddff, 0x000000, 1); c.addLegend(90, 10, false, "Arial Bold", 7).setBackground(0xcccccc); c.setPlotArea(60, 60, 700, 430, 0xffffff).setGridColor(0xcccccc, 0xccccccc); c.xAxis().setTitle("Year"); c.xAxis().setLabelStyle("Arial", 8, 1).setFontAngle(90); c.yAxis().setLinearScale(0, 200, 10, 0); c.yAxis2().setLogScale(0, 1000, 10); LineLayer layer = c.addLineLayer2(); layer.setLineWidth(2); layer.addDataSet(Weight, 0xff0000, "Weight").setDataSymbol(Chart.CircleShape, 5); int count = YearWeightBMI.Length; layer.setXData(YearWeightBMI); LineLayer layer1 = c.addLineLayer2(); layer1.setLineWidth(2); layer1.setUseYAxis2(); layer1.addDataSet(BMI, 0x008800, "BMI").setDataSymbol(Chart.CircleShape, 5); layer1.setXData(YearWeightBMI); // Output the chart Wviewer.Image = c.makeWebImage(Chart.PNG); //Include tool tip for the chart Wviewer.ImageMap = c.getHTMLImageMap("", "", "title='{dataSetName} Count on {xLabel}={value}'"); }
// // Create chart // private void createChart(RazorChartViewer viewer) { // The data for the bar chart double[] data = { 85, 156, 179.5, 211, 123 }; // The labels for the bar chart string[] labels = { "Mon", "Tue", "Wed", "Thu", "Fri" }; // Create a XYChart object of size 300 x 280 pixels XYChart c = new XYChart(300, 280); // Set the plotarea at (45, 30) and of size 200 x 200 pixels c.setPlotArea(45, 30, 200, 200); // Add a title to the chart c.addTitle("Weekly Server Load"); // Add a title to the y axis c.yAxis().setTitle("MBytes"); // Add a title to the x axis c.xAxis().setTitle("Work Week 25"); // Add a bar chart layer with green (0x00ff00) bars using the given data c.addBarLayer(data, 0x00ff00).set3D(); // Set the labels on the x axis. c.xAxis().setLabels(labels); // Output the chart viewer.Image = c.makeWebImage(Chart.PNG); // Include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("", "", "title='{xLabel}: {value} MBytes'"); }
private void createChartCD4(WebChartViewer viewer, Double[] CD4, Double[] ViralLoad, DateTime[] YearCD4, DateTime[] YearVL, DateTime[] Year) { XYChart c = new XYChart(900, 570, 0xddddff, 0x000000, 1); c.addLegend(90, 10, false, "Arial Bold", 7).setBackground(0xcccccc); c.setPlotArea(60, 60, 700, 430, 0xffffff).setGridColor(0xcccccc, 0xccccccc); c.xAxis().setTitle("Year"); c.xAxis().setLabelStyle("Arial", 8, 1).setFontAngle(90); c.yAxis().setLinearScale(0, 1500, 100, 0); c.yAxis2().setLogScale(10, 10000, 10); LineLayer layer = c.addLineLayer2(); layer.setLineWidth(2); layer.addDataSet(CD4, 0xff0000, "CD4").setDataSymbol(Chart.CircleShape, 5); layer.setXData(YearCD4); LineLayer layer1 = c.addLineLayer2(); layer1.setLineWidth(2); layer1.setUseYAxis2(); layer1.addDataSet(ViralLoad, 0x008800, "Viralload").setDataSymbol(Chart.CircleShape, 5); layer1.setXData(YearVL); // Output the chart viewer.Image = c.makeWebImage(Chart.PNG); viewer.ImageMap = c.getHTMLImageMap("", "", "title='{dataSetName} Count on {xLabel}={value}'"); }
//Main code for creating charts public void createChart(WinChartViewer viewer, int chartIndex) { // The data for the chart double[] data = { 100, 125, 260, 147, 67 }; string[] labels = { "Mon", "Tue", "Wed", "Thu", "Fri" }; // Create a XYChart object of size 200 x 180 pixels XYChart c = new XYChart(200, 180); // Set the plot area at (30, 10) and of size 140 x 130 pixels c.setPlotArea(30, 10, 140, 130); // Ise log scale axis if required if (chartIndex == 1) { c.yAxis().setLogScale3(); } // Set the labels on the x axis c.xAxis().setLabels(labels); // Add a color bar layer using the given data. Use a 1 pixel 3D border for the bars. c.addBarLayer3(data).setBorderColor(-1, 1); // Output the chart viewer.Chart = c; //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='Mileage on {xLabel}: {value} miles'"); }
//Main code for creating chart. //Note: the argument img is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, string img) { // The XY points for the scatter chart double[] dataX = { 150, 400, 300, 1500, 800 }; double[] dataY = { 0.6, 8, 5.4, 2, 4 }; // The labels for the points string[] labels = { "Nano\n100", "SpeedTron\n200 Lite", "SpeedTron\n200", "Marathon\nExtra", "Marathon\n2000" }; // Create a XYChart object of size 450 x 400 pixels XYChart c = new XYChart(450, 400); // Set the plotarea at (55, 40) and of size 350 x 300 pixels, with a // light grey border (0xc0c0c0). Turn on both horizontal and vertical // grid lines with light grey color (0xc0c0c0) c.setPlotArea(55, 40, 350, 300, 0xffffff, -1, 0xc0c0c0, 0xc0c0c0, -1); // Add a title to the chart using 18 pts Times Bold Itatic font. c.addTitle("Product Comparison Chart", "Times New Roman Bold Italic", 18) ; // Add a title to the y axis using 12 pts Arial Bold Italic font c.yAxis().setTitle("Capacity (tons)", "Arial Bold Italic", 12); // Add a title to the x axis using 12 pts Arial Bold Italic font c.xAxis().setTitle("Range (miles)", "Arial Bold Italic", 12); // Set the axes line width to 3 pixels c.xAxis().setWidth(3); c.yAxis().setWidth(3); // Add the data as a scatter chart layer, using a 15 pixel circle as the // symbol ScatterLayer layer = c.addScatterLayer(dataX, dataY, "", Chart.GlassSphereShape, 15, 0xff3333, 0xff3333); // Add labels to the chart as an extra field layer.addExtraField(labels); // Set the data label format to display the extra field layer.setDataLabelFormat("{field0}"); // Use 8pts Arial Bold to display the labels ChartDirector.TextBox textbox = layer.setDataLabelStyle("Arial Bold", 8); // Set the background to purple with a 1 pixel 3D border textbox.setBackground(0xcc99ff, Chart.Transparent, 1); // Put the text box 4 pixels to the right of the data point textbox.setAlignment(Chart.Left); textbox.setPos(4, 0); // Output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='Range = {x} miles, Capacity = {value} tons'"); }
//Main code for creating chart. //Note: the argument img is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, string img) { // The data for the bar chart double[] data = { 3.9, 8.1, 10.9, 14.2, 18.1, 19.0, 21.2, 23.2, 25.7, 36 }; // The labels for the bar chart string[] labels = { "Bastic Group", "Simpa", "YG Super", "CID", "Giga Tech", "Indo Digital", "Supreme", "Electech","THP Thunder", "Flash Light" }; // Create a XYChart object of size 600 x 250 pixels XYChart c = new XYChart(600, 250); // Add a title to the chart using Arial Bold Italic font c.addTitle("Revenue Estimation - Year 2002", "Arial Bold Italic"); // Set the plotarea at (100, 30) and of size 400 x 200 pixels. Set the // plotarea border, background and grid lines to Transparent c.setPlotArea(100, 30, 400, 200, Chart.Transparent, Chart.Transparent, Chart.Transparent, Chart.Transparent, Chart.Transparent); // Add a bar chart layer using the given data. Use a gradient color for // the bars, where the gradient is from dark green (0x008000) to white // (0xffffff) BarLayer layer = c.addBarLayer(data, c.gradientColor(100, 0, 500, 0, 0x008000, 0xffffff)); // Swap the axis so that the bars are drawn horizontally c.swapXY(true); // Set the bar gap to 10% layer.setBarGap(0.1); // Use the format "US$ xxx millions" as the bar label layer.setAggregateLabelFormat("US$ {value} millions"); // Set the bar label font to 10 pts Times Bold Italic/dark red (0x663300) layer.setAggregateLabelStyle("Times New Roman Bold Italic", 10, 0x663300) ; // Set the labels on the x axis ChartDirector.TextBox textbox = c.xAxis().setLabels(labels); // Set the x axis label font to 10pt Arial Bold Italic textbox.setFontStyle("Arial Bold Italic"); textbox.setFontSize(10); // Set the x axis to Transparent, with labels in dark red (0x663300) c.xAxis().setColors(Chart.Transparent, 0x663300); // Set the y axis and labels to Transparent c.yAxis().setColors(Chart.Transparent, Chart.Transparent); // Output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='{xLabel}: US${value} millions'"); }
//Main code for creating chart. //Note: the argument img is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, string img) { // The data for the bar chart double[] data = { 85, 156, 179.5, 211, 123 }; // The labels for the bar chart string[] labels = { "Mon", "Tue", "Wed", "Thu", "Fri" }; // Create a XYChart object of size 250 x 250 pixels XYChart c = new XYChart(250, 250); // Set the plotarea at (30, 20) and of size 200 x 200 pixels c.setPlotArea(30, 20, 200, 200); // Add a bar chart layer using the given data c.addBarLayer(data); // Set the labels on the x axis. c.xAxis().setLabels(labels); // Output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='{xLabel}: US${value}K'"); }
//Main code for creating chart. //Note: the argument img is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, string img) { // The data for the area chart double[] data = { 3.0, 2.8, 4.0, 5.5, 7.5, 6.8, 5.4, 6.0, 5.0, 6.2, 7.5, 6.5, 7.5, 8.1, 6.0, 5.5, 5.3, 3.5, 5.0, 6.6, 5.6, 4.8, 5.2, 6.5, 6.2 } ; // The labels for the area chart string[] labels = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19","20", "21", "22", "23", "24" }; // Create a XYChart object of size 300 x 180 pixels. Set the background // to pale yellow (0xffffa0) with a black border (0x0) XYChart c = new XYChart(300, 180, 0xffffa0, 0x000000); // Set the plotarea at (45, 35) and of size 240 x 120 pixels. Set the // background to white (0xffffff). Set both horizontal and vertical grid // lines to black (&H0&) dotted lines (pattern code 0x0103) c.setPlotArea(45, 35, 240, 120, 0xffffff, -1, -1, c.dashLineColor( 0x000000, 0x000103), c.dashLineColor(0x000000, 0x000103)); // Add a title to the chart using 10 pts Arial Bold font. Use a 1 x 2 // bitmap pattern as the background. Set the border to black (0x0). c.addTitle("Snow Percipitation (Dec 12)", "Arial Bold", 10 ).setBackground(c.patternColor(new int[] { 0xb0b0f0, 0xe0e0ff }, 2), 0x000000); // Add a title to the y axis c.yAxis().setTitle("mm per hour"); // Set the labels on the x axis. c.xAxis().setLabels(labels); // Display 1 out of 3 labels on the x-axis. c.xAxis().setLabelStep(3); // Add an area layer to the chart AreaLayer layer = c.addAreaLayer(); // Load a snow pattern from an external file "snow.png". int snowPattern = c.patternColor2("snow.png"); // Add a data set to the area layer using the snow pattern as the fill // color. Use deep blue (0x0000ff) as the area border line color // (&H0000ff&) layer.addDataSet(data).setDataColor(snowPattern, 0x0000ff); // Set the line width to 2 pixels to highlight the line layer.setLineWidth(2); // Output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='{xLabel}:00 - {value} mm/hour'"); }
//Main code for creating chart. //Note: the argument img is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, string img) { // The data for the chart double[] data0 = { 0.05, 0.06, 0.48, 0.1, 0.01, 0.05 }; double[] data1 = { 100, 125, 265, 147, 67, 105 }; string[] labels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun" }; // Create a XYChart object of size 300 x 180 pixels XYChart c = new XYChart(300, 180); // Set the plot area at (50, 20) and of size 200 x 130 pixels c.setPlotArea(50, 20, 200, 130); // Add a title to the chart using 8 pts Arial Bold font c.addTitle("Independent Y-Axis Demo", "Arial Bold", 8); // Set the labels on the x axis. c.xAxis().setLabels(labels); // Add a title to the primary (left) y axis c.yAxis().setTitle("Packet Drop Rate (pps)"); // Set the axis, label and title colors for the primary y axis to red // (0xc00000) to match the first data set c.yAxis().setColors(0xc00000, 0xc00000, 0xc00000); // Add a title to the secondary (right) y axis c.yAxis2().setTitle("Throughtput (MBytes)"); // set the axis, label and title colors for the primary y axis to green // (0x008000) to match the second data set c.yAxis2().setColors(0x008000, 0x008000, 0x008000); // Add a line layer to for the first data set using red (0xc00000) color // with a line width to 3 pixels LineLayer lineLayer = c.addLineLayer(data0, 0xc00000); lineLayer.setLineWidth(3); // tool tip for the line layer lineLayer.setHTMLImageMap("", "", "title='Packet Drop Rate on {xLabel}: {value} pps'"); // Add a bar layer to for the second data set using green (0x00C000) // color. Bind the second data set to the secondary (right) y axis BarLayer barLayer = c.addBarLayer(data1, 0x00c000); barLayer.setUseYAxis2(); // tool tip for the bar layer barLayer.setHTMLImageMap("", "", "title='Throughput on {xLabel}: {value} MBytes'"); // Output the chart viewer.Image = c.makeImage(); // include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable"); }
// // Create chart // private void createChart(RazorChartViewer viewer) { // 4 data points to represent the cash flow for the Q1 - Q4 double[] data = { 230, 140, 220, 330, 150 }; // We want to plot a waterfall chart showing the 4 quarters as well as the total string[] labels = { "Product 1", "Product 2", "Product 3", "Product 4", "Product 5", "Total" }; // The top side of the bars in a waterfall chart is the accumulated data. We use the // ChartDirector ArrayMath utility to accumulate the data. The "total" is handled by // inserting a zero point at the end before accumulation (after accumulation it will become // the total). double[] boxTop = new ArrayMath(data).insert2(0, 1).acc().result(); // The botom side of the bars is just the top side of the previous bar. So we shifted the top // side data to obtain the bottom side data. double[] boxBottom = new ArrayMath(boxTop).shift(1, 0).result(); // The last point (total) is different. Its bottom side is always 0. boxBottom[boxBottom.Length - 1] = 0; // Create a XYChart object of size 500 x 280 pixels. Set background color to light blue // (ccccff), with 1 pixel 3D border effect. XYChart c = new XYChart(500, 290, 0xccccff, 0x000000, 1); // Add a title to the chart using 13 points Arial Bold Itatic font, with white (ffffff) text // on a deep blue (0x80) background c.addTitle("Product Revenue - Year 2004", "Arial Bold Italic", 13, 0xffffff).setBackground( 0x000080); // Set the plotarea at (55, 50) and of size 430 x 215 pixels. Use alternative white/grey // background. c.setPlotArea(55, 45, 430, 215, 0xffffff, 0xeeeeee); // Set the labels on the x axis using Arial Bold font c.xAxis().setLabels(labels).setFontStyle("Arial Bold"); // Set the x-axis ticks and grid lines to be between the bars c.xAxis().setTickOffset(0.5); // Use Arial Bold as the y axis label font c.yAxis().setLabelStyle("Arial Bold"); // Add a title to the y axis c.yAxis().setTitle("USD (in millions)"); // Add a multi-color box-whisker layer to represent the waterfall bars BoxWhiskerLayer layer = c.addBoxWhiskerLayer2(boxTop, boxBottom); // Put data labels on the bars to show the cash flow using Arial Bold font layer.setDataLabelFormat("{={top}-{bottom}}M"); layer.setDataLabelStyle("Arial Bold").setAlignment(Chart.Center); // Output the chart viewer.Image = c.makeWebImage(Chart.PNG); // Include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("", "", "title='{xLabel}: {={top}-{bottom}} millions'"); }
//Main code for creating chart. //Note: the argument img is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, string img) { // The data for the bar chart double[] data = { 450, 560, 630, 800, 1100, 1350, 1600, 1950, 2300, 2700 }; // The labels for the bar chart string[] labels = { "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005" }; // Create a XYChart object of size 600 x 380 pixels. Set background color // to brushed silver, with a 2 pixel 3D border. Use rounded corners of 20 // pixels radius. XYChart c = new XYChart(600, 380, Chart.brushedSilverColor(), Chart.Transparent, 2); // Add a title to the chart using 18pts Times Bold Italic font. Set // top/bottom margins to 8 pixels. c.addTitle("Annual Revenue for Star Tech", "Times New Roman Bold Italic", 18).setMargin2(0, 0, 8, 8); // Set the plotarea at (70, 55) and of size 460 x 280 pixels. Use // transparent border and black grid lines. Use rounded frame with radius // of 20 pixels. c.setPlotArea(70, 55, 460, 280, -1, -1, Chart.Transparent, 0x000000); c.setRoundedFrame(0xffffff, 20); // Add a multi-color bar chart layer using the supplied data. Set // cylinder bar shape. c.addBarLayer3(data).setBarShape(Chart.CircleShape); // Set the labels on the x axis. c.xAxis().setLabels(labels); // Show the same scale on the left and right y-axes c.syncYAxis(); // Set the left y-axis and right y-axis title using 10pt Arial Bold font c.yAxis().setTitle("USD (millions)", "Arial Bold", 10); c.yAxis2().setTitle("USD (millions)", "Arial Bold", 10); // Set y-axes to transparent c.yAxis().setColors(Chart.Transparent); c.yAxis2().setColors(Chart.Transparent); // Disable ticks on the x-axis by setting the tick color to transparent c.xAxis().setTickColor(Chart.Transparent); // Set the label styles of all axes to 8pt Arial Bold font c.xAxis().setLabelStyle("Arial Bold", 8); c.yAxis().setLabelStyle("Arial Bold", 8); c.yAxis2().setLabelStyle("Arial Bold", 8); // Output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='Year {xLabel}: US$ {value}M'"); }
// // Create chart // private void createChart(RazorChartViewer viewer) { // Data for the chart double[] data0 = { 100, 125, 245, 147, 67, 96, 160, 145, 97, 167, 220, 125 }; double[] data1 = { 85, 156, 179, 211, 123, 225, 127, 99, 111, 260, 175, 156 }; double[] data2 = { 97, 87, 56, 267, 157, 157, 67, 156, 77, 87, 197, 87 }; string[] labels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" }; // Create a XYChart object of size 560 x 280 pixels. XYChart c = new XYChart(560, 280); // Add a title to the chart using 14pt Arial Bold Italic font c.addTitle(" Average Weekly Network Load", "Arial Bold Italic", 14); // Set the plotarea at (50, 50) and of 500 x 200 pixels in size. Use alternating light grey // (f8f8f8) / white (ffffff) background. Set border to transparent and use grey (CCCCCC) // dotted lines as horizontal and vertical grid lines c.setPlotArea(50, 50, 500, 200, 0xffffff, 0xf8f8f8, Chart.Transparent, c.dashLineColor( 0xcccccc, Chart.DotLine), c.dashLineColor(0xcccccc, Chart.DotLine)); // Add a legend box at (50, 22) using horizontal layout. Use 10 pt Arial Bold Italic font, // with transparent background c.addLegend(50, 22, false, "Arial Bold Italic", 10).setBackground(Chart.Transparent); // Set the x axis labels c.xAxis().setLabels(labels); // Draw the ticks between label positions (instead of at label positions) c.xAxis().setTickOffset(0.5); // Add axis title c.yAxis().setTitle("Throughput (MBytes Per Hour)"); // Set axis line width to 2 pixels c.xAxis().setWidth(2); c.yAxis().setWidth(2); // Add a multi-bar layer with 3 data sets BarLayer layer = c.addBarLayer2(Chart.Side); layer.addDataSet(data0, 0xff0000, "Server #1"); layer.addDataSet(data1, 0x00ff00, "Server #2"); layer.addDataSet(data2, 0x0000ff, "Server #3"); // Set bar shape to circular (cylinder) layer.setBarShape(Chart.CircleShape); // Configure the bars within a group to touch each others (no gap) layer.setBarGap(0.2, Chart.TouchBar); // Output the chart viewer.Image = c.makeWebImage(Chart.PNG); // Include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("", "", "title='{dataSetName} on {xLabel}: {value} MBytes/hour'"); }
// // Create chart // private void createChart(RazorChartViewer viewer) { // The data for the chart double[] data0 = { 600, 800, 1200, 1500, 1800, 1900, 2000, 1950 }; double[] data1 = { 300, 450, 500, 1000, 1500, 1600, 1650, 1600 }; // The labels for the chart string[] labels = { "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002" }; // Create a XYChart object of size 450 x 250 pixels, with a pale yellow (0xffffc0) // background, a black border, and 1 pixel 3D border effect. XYChart c = new XYChart(450, 250, 0xffffc0, 0, 1); // Set the plotarea at (60, 45) and of size 360 x 170 pixels, using white (0xffffff) as the // plot area background color. Turn on both horizontal and vertical grid lines with light // grey color (0xc0c0c0) c.setPlotArea(60, 45, 360, 170, 0xffffff, -1, -1, 0xc0c0c0, -1); // Add a legend box at (60, 20) (top of the chart) with horizontal layout. Use 8pt Arial Bold // font. Set the background and border color to Transparent. c.addLegend(60, 20, false, "Arial Bold", 8).setBackground(Chart.Transparent); // Add a title to the chart using 12pt Arial Bold/white font. Use a 1 x 2 bitmap pattern as // the background. c.addTitle("Information Resource Usage", "Arial Bold", 12, 0xffffff).setBackground( c.patternColor(new int[] { 0x000040, 0x000080 }, 2)); // Set the labels on the x axis c.xAxis().setLabels(labels); // Reserve 8 pixels margins at both side of the x axis to avoid the first and last symbols // drawing outside of the plot area c.xAxis().setMargin(8, 8); // Add a title to the y axis c.yAxis().setTitle("Population"); // Add a line layer to the chart LineLayer layer = c.addLineLayer2(); // Add the first line using small_user.png as the symbol. layer.addDataSet(data0, 0xcf4040, "Users").setDataSymbol2(Url.Content( "~/Content/small_user.png")); // Add the first line using small_computer.png as the symbol. layer.addDataSet(data1, 0x40cf40, "Computers").setDataSymbol2(Url.Content( "~/Content/small_computer.png")); // Set the line width to 3 pixels layer.setLineWidth(3); // Output the chart viewer.Image = c.makeWebImage(Chart.PNG); // Include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("", "", "title='Number of {dataSetName} at {xLabel}: {value}'"); }
//Main code for creating chart. //Note: the argument img is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, string img) { // The data for the bar chart double[] data0 = { 100, 125, 245, 147 }; double[] data1 = { 85, 156, 179, 211 }; double[] data2 = { 97, 87, 56, 267 }; string[] labels = { "1st Quarter", "2nd Quarter", "3rd Quarter", "4th Quarter" }; // Create a XYChart object of size 600 x 350 pixels XYChart c = new XYChart(600, 350); // Add a title to the chart using 14 pts Arial Bold Italic font c.addTitle("Annual Product Revenue", "Arial Bold Italic", 14); // Set the plot area at (50, 60) and of size 500 x 240. Use two // alternative background colors (f8f8f8 and ffffff) c.setPlotArea(50, 60, 500, 240, 0xf8f8f8, 0xffffff); // Add a legend box at (55, 22) using horizontal layout, with transparent // background c.addLegend(55, 22, false).setBackground(Chart.Transparent); // Set the x axis labels c.xAxis().setLabels(labels); // Draw the ticks between label positions (instead of at label positions) c.xAxis().setTickOffset(0.5); // Add a multi-bar layer with 3 data sets and 9 pixels 3D depth BarLayer layer = c.addBarLayer2(Chart.Side, 9); layer.addDataSet(data0, -1, "Product A"); layer.addDataSet(data1, -1, "Product B"); layer.addDataSet(data2, -1, "Product C"); // Set data set 1 to use a bar shape of a 6-pointed star layer.setBarShape(Chart.StarShape(6), 0); // Set data set 2 to use a bar shapre of a 6-sided polygon layer.setBarShape(Chart.PolygonShape(6), 1); // Set data set 3 to use an X bar shape layer.setBarShape(Chart.Cross2Shape(), 2); // Add a title to the y-axis c.yAxis().setTitle("Revenue (USD in millions)"); // Add a title to the x axis c.xAxis().setTitle("Year 2005"); // Output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='{dataSetName}: {xLabel} Revenue = {value} millions'"); }
//Main code for creating chart. //Note: the argument chartIndex is unused because this demo only has 1 chart. public void createChart(WPFChartViewer viewer, int chartIndex) { // The data for the chart double[] dataY0 = { 4, 4.5, 5, 5.25, 5.75, 5.25, 5, 4.5, 4, 3, 2.5, 2.5 }; DateTime[] dataX0 = { new DateTime(1997, 1, 1), new DateTime(1998, 6, 25), new DateTime( 1999, 9, 6), new DateTime(2000, 2, 6), new DateTime(2000, 9,21), new DateTime(2001, 3, 4), new DateTime(2001, 6, 8), new DateTime(2002,2, 4),new DateTime(2002, 5, 19 ), new DateTime(2002, 8, 16), new DateTime(2002, 12, 1), new DateTime(2003, 1, 1) }; double[] dataY1 = { 7, 6.5, 6, 5, 6.5, 7, 6, 5.5, 5, 4, 3.5, 3.5 }; DateTime[] dataX1 = { new DateTime(1997, 1, 1), new DateTime(1997, 7, 1), new DateTime( 1997, 12, 1), new DateTime(1999, 1,15), new DateTime(1999, 6,9), new DateTime( 2000, 3, 3), new DateTime(2000, 8,13), new DateTime(2001, 5,5), new DateTime(2001, 9, 16), new DateTime(2002, 3, 16), new DateTime(2002,6, 1),new DateTime(2003, 1, 1 ) }; // Create a XYChart object of size 500 x 270 pixels, with a pale blue (e0e0ff) // background, black border, 1 pixel 3D border effect and rounded corners XYChart c = new XYChart(600, 300, 0xe0e0ff, 0x000000, 1); c.setRoundedFrame(); // Set the plotarea at (55, 60) and of size 520 x 200 pixels, with white (ffffff) // background. Set horizontal and vertical grid lines to grey (cccccc). c.setPlotArea(50, 60, 525, 200, 0xffffff, -1, -1, 0xcccccc, 0xcccccc); // Add a legend box at (55, 32) (top of the chart) with horizontal layout. Use 9pt Arial // Bold font. Set the background and border color to Transparent. c.addLegend(55, 32, false, "Arial Bold", 9).setBackground(Chart.Transparent); // Add a title box to the chart using 15pt Times Bold Italic font. The text is white // (ffffff) on a deep blue (000088) background, with soft lighting effect from the right // side. c.addTitle("Long Term Interest Rates", "Times New Roman Bold Italic", 15, 0xffffff ).setBackground(0x000088, -1, Chart.softLighting(Chart.Right)); // Set the y axis label format to display a percentage sign c.yAxis().setLabelFormat("{value}%"); // Add a red (ff0000) step line layer to the chart and set the line width to 2 pixels StepLineLayer layer0 = c.addStepLineLayer(dataY0, 0xff0000, "Country AAA"); layer0.setXData(dataX0); layer0.setLineWidth(2); // Add a blue (0000ff) step line layer to the chart and set the line width to 2 pixels StepLineLayer layer1 = c.addStepLineLayer(dataY1, 0x0000ff, "Country BBB"); layer1.setXData(dataX1); layer1.setLineWidth(2); // Output the chart viewer.Chart = c; //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='{dataSetName} change to {value}% on {x|mmm dd, yyyy}'"); }
//Main code for creating chart. //Note: the argument chartIndex is unused because this demo only has 1 chart. public void createChart(WPFChartViewer viewer, int chartIndex) { // Sample data for the Box-Whisker chart. Represents the minimum, 1st quartile, medium, // 3rd quartile and maximum values of some quantities double[] Q0Data = { 40, 45, 40, 30, 20, 50, 25, 44 }; double[] Q1Data = { 55, 60, 50, 40, 38, 60, 51, 60 }; double[] Q2Data = { 62, 70, 60, 50, 48, 70, 62, 70 }; double[] Q3Data = { 70, 80, 65, 60, 53, 78, 69, 76 }; double[] Q4Data = { 80, 90, 75, 70, 60, 85, 80, 84 }; // The labels for the chart string[] labels = { "A", "B", "C", "D", "E", "F", "G", "H" }; // Create a XYChart object of size 450 x 400 pixels XYChart c = new XYChart(450, 400); // Set the plotarea at (50, 30) and of size 380 x 340 pixels, with transparent // background and border and light grey (0xcccccc) horizontal grid lines c.setPlotArea(50, 30, 380, 340, Chart.Transparent, -1, Chart.Transparent, 0xcccccc); // Add a title box using grey (0x555555) 18pt Arial font ChartDirector.TextBox title = c.addTitle(" Pattern Recognition Accuracy", "Arial", 18, 0x555555); // Set the x and y axis stems to transparent and the label font to 12pt Arial c.xAxis().setColors(Chart.Transparent); c.yAxis().setColors(Chart.Transparent); c.xAxis().setLabelStyle("Arial", 12); c.yAxis().setLabelStyle("Arial", 12); // Set the labels on the x axis c.xAxis().setLabels(labels); // For the automatic y-axis labels, set the minimum spacing to 30 pixels. c.yAxis().setTickDensity(30); // Add a box whisker layer using light blue (0x99ccee) for the fill color and blue // (0x6688aa) for the whisker color. Set line width to 2 pixels. Use rounded corners and // bar lighting effect. BoxWhiskerLayer b = c.addBoxWhiskerLayer(Q3Data, Q1Data, Q4Data, Q0Data, Q2Data, 0x99ccee, 0x6688aa); b.setLineWidth(2); b.setRoundedCorners(); b.setBorderColor(Chart.Transparent, Chart.barLighting()); // Adjust the plot area to fit under the title with 10-pixel margin on the other three // sides. c.packPlotArea(10, title.getHeight(), c.getWidth() - 10, c.getHeight() - 10); // Output the chart viewer.Chart = c; //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='[{xLabel}] min/med/max = {min}/{med}/{max}\nInter-quartile range: " + "{bottom} to {top}'"); }
//Main code for creating chart. //Note: the argument chartIndex is unused because this demo only has 1 chart. public void createChart(WPFChartViewer viewer, int chartIndex) { // Use random table to generate a random series. The random table is set to 1 col x 51 // rows, with 9 as the seed RanTable rantable = new RanTable(9, 1, 51); // Set the 1st column to start from 100, with changes between rows from -5 to +5 rantable.setCol(0, 100, -5, 5); // Get the 1st column of the random table as the data set double[] data = rantable.getCol(0); // Create a XYChart object of size 600 x 300 pixels XYChart c = new XYChart(600, 300); // Set the plotarea at (50, 35) and of size 500 x 240 pixels. Enable both the horizontal // and vertical grids by setting their colors to grey (0xc0c0c0) c.setPlotArea(50, 35, 500, 240).setGridColor(0xc0c0c0, 0xc0c0c0); // Add a title to the chart using 18 point Times Bold Itatic font. c.addTitle("LOWESS Generic Curve Fitting Algorithm", "Times New Roman Bold Italic", 18); // Set the y axis line width to 3 pixels c.yAxis().setWidth(3); // Add a title to the x axis using 12pt Arial Bold Italic font c.xAxis().setTitle("Server Load (TPS)", "Arial Bold Italic", 12); // Set the x axis line width to 3 pixels c.xAxis().setWidth(3); // Set the x axis scale from 0 - 50, with major tick every 5 units and minor tick every // 1 unit c.xAxis().setLinearScale(0, 50, 5, 1); // Add a blue layer to the chart LineLayer layer = c.addLineLayer2(); // Add a red (0x80ff0000) data set to the chart with square symbols layer.addDataSet(data, unchecked ((int)0x80ff0000)).setDataSymbol(Chart.SquareSymbol); // Set the line width to 2 pixels layer.setLineWidth(2); // Use lowess for curve fitting, and plot the fitted data using a spline layer with line // width set to 3 pixels c.addSplineLayer(new ArrayMath(data).lowess().result(), 0x0000ff).setLineWidth(3); // Set zero affinity to 0 to make sure the line is displayed in the most detail scale c.yAxis().setAutoScale(0, 0, 0); // Output the chart viewer.Chart = c; //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='({x}, {value|2})'"); }
//Main code for creating charts public void createChart(WinChartViewer viewer, string img) { // The data for the chart double[] data = { 5.5, 3.5, -3.7, 1.7, -1.4, 3.3 }; string[] labels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun" }; // Create a XYChart object of size 200 x 190 pixels XYChart c = new XYChart(200, 190); // Set the plot area at (30, 20) and of size 140 x 140 pixels c.setPlotArea(30, 20, 140, 140); // Configure the axis as according to the input parameter if (img == "0") { c.addTitle("No Axis Extension", "Arial", 8); } else if (img == "1") { c.addTitle("Top/Bottom Extensions = 0/0", "Arial", 8); // Reserve 20% margin at top of plot area when auto-scaling c.yAxis().setAutoScale(0, 0); } else if (img == "2") { c.addTitle("Top/Bottom Extensions = 0.2/0.2", "Arial", 8); // Reserve 20% margin at top and bottom of plot area when // auto-scaling c.yAxis().setAutoScale(0.2, 0.2); } else if (img == "3") { c.addTitle("Axis Top Margin = 15", "Arial", 8); // Reserve 15 pixels at top of plot area c.yAxis().setMargin(15); } else { c.addTitle("Manual Scale -5 to 10", "Arial", 8); // Set the y axis to scale from -5 to 10, with ticks every 5 units c.yAxis().setLinearScale(-5, 10, 5); } // Set the labels on the x axis c.xAxis().setLabels(labels); // Add a color bar layer using the given data. Use a 1 pixel 3D border // for the bars. c.addBarLayer3(data).setBorderColor(-1, 1); // Output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='ROI for {xLabel}: {value}%'"); }
//Main code for creating chart. //Note: the argument img is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, string img) { // The XYZ points for the bubble chart double[] dataX0 = { 170, 300, 1000, 1700 }; double[] dataY0 = { 16, 69, 16, 75 }; double[] dataZ0 = { 52, 105, 88, 140 }; double[] dataX1 = { 500, 1000, 1300 }; double[] dataY1 = { 40, 58, 85 }; double[] dataZ1 = { 140, 202, 84 }; // Create a XYChart object of size 540 x 480 pixels XYChart c = new XYChart(540, 480); // Set the plotarea at (70, 65) and of size 400 x 350 pixels. Turn on // both horizontal and vertical grid lines with light grey color // (0xc0c0c0) c.setPlotArea(70, 65, 400, 350, -1, -1, Chart.Transparent, 0xc0c0c0, -1); // Add a legend box at (70, 30) (top of the chart) with horizontal // layout. Use 12 pts Times Bold Italic font. Set the background and // border color to Transparent. c.addLegend(70, 30, false, "Times New Roman Bold Italic", 12 ).setBackground(Chart.Transparent); // Add a title to the chart using 18 pts Times Bold Itatic font. c.addTitle("Product Comparison Chart", "Times New Roman Bold Italic", 18) ; // Add titles to the axes using 12 pts Arial Bold Italic font c.yAxis().setTitle("Capacity (tons)", "Arial Bold Italic", 12); c.xAxis().setTitle("Range (miles)", "Arial Bold Italic", 12); // Set the axes line width to 3 pixels c.xAxis().setWidth(3); c.yAxis().setWidth(3); // Add (dataX0, dataY0) as a scatter layer with red (ff3333) glass // spheres, where the sphere size is modulated by dataZ0. This creates a // bubble effect. c.addScatterLayer(dataX0, dataY0, "Technology AAA", Chart.GlassSphere2Shape, 15, 0xff3333).setSymbolScale(dataZ0); // Add (dataX1, dataY1) as a scatter layer with blue (0000ff) glass // spheres, where the sphere size is modulated by dataZ1. This creates a // bubble effect. c.addScatterLayer(dataX1, dataY1, "Technology BBB", Chart.GlassSphere2Shape, 15, 0x0000ff).setSymbolScale(dataZ1); // Output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='[{dataSetName}] Range = {x} miles, Capacity = {value} " + "tons, Length = {z} meters'"); }
//Main code for creating chart. //Note: the argument chartIndex is unused because this demo only has 1 chart. public void createChart(WPFChartViewer viewer, int chartIndex) { // The XYZ points for the bubble chart double[] dataX0 = { 150, 300, 1000, 1700 }; double[] dataY0 = { 12, 60, 25, 65 }; double[] dataZ0 = { 20, 50, 50, 85 }; double[] dataX1 = { 500, 1000, 1300 }; double[] dataY1 = { 35, 50, 75 }; double[] dataZ1 = { 30, 55, 95 }; // Create a XYChart object of size 450 x 420 pixels XYChart c = new XYChart(450, 420); // Set the plotarea at (55, 65) and of size 350 x 300 pixels, with a light grey border // (0xc0c0c0). Turn on both horizontal and vertical grid lines with light grey color // (0xc0c0c0) c.setPlotArea(55, 65, 350, 300, -1, -1, 0xc0c0c0, 0xc0c0c0, -1); // Add a legend box at (50, 30) (top of the chart) with horizontal layout. Use 12pt // Times Bold Italic font. Set the background and border color to Transparent. c.addLegend(50, 30, false, "Times New Roman Bold Italic", 12).setBackground( Chart.Transparent); // Add a title to the chart using 18pt Times Bold Itatic font. c.addTitle("Product Comparison Chart", "Times New Roman Bold Italic", 18); // Add a title to the y axis using 12pt Arial Bold Italic font c.yAxis().setTitle("Capacity (tons)", "Arial Bold Italic", 12); // Add a title to the x axis using 12pt Arial Bold Italic font c.xAxis().setTitle("Range (miles)", "Arial Bold Italic", 12); // Set the axes line width to 3 pixels c.xAxis().setWidth(3); c.yAxis().setWidth(3); // Add (dataX0, dataY0) as a scatter layer with semi-transparent red (0x80ff3333) circle // symbols, where the circle size is modulated by dataZ0. This creates a bubble effect. c.addScatterLayer(dataX0, dataY0, "Technology AAA", Chart.CircleSymbol, 9, unchecked ((int)0x80ff3333), unchecked ((int)0x80ff3333)).setSymbolScale(dataZ0); // Add (dataX1, dataY1) as a scatter layer with semi-transparent green (0x803333ff) // circle symbols, where the circle size is modulated by dataZ1. This creates a bubble // effect. c.addScatterLayer(dataX1, dataY1, "Technology BBB", Chart.CircleSymbol, 9, unchecked ((int)0x803333ff), unchecked ((int)0x803333ff)).setSymbolScale(dataZ1); // Output the chart viewer.Chart = c; //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='[{dataSetName}] Range = {x} miles, Capacity = {value} tons, Length = {z} " + "meters'"); }
// // Create chart // private void createChart(RazorChartViewer viewer) { // The data for the bar chart double[] data = { -6.3, 2.3, 0.7, -3.4, 2.2, -2.9, -0.1, -0.1, 3.3, 6.2, 4.3, 1.6 }; // The labels for the bar chart string[] labels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; // Create a XYChart object of size 500 x 320 pixels XYChart c = new XYChart(500, 320); // Add a title to the chart using Arial Bold Italic font c.addTitle("Productivity Change - Year 2005", "Arial Bold Italic"); // Set the plotarea at (50, 30) and of size 400 x 250 pixels c.setPlotArea(50, 30, 400, 250); // Add a bar layer to the chart using the Overlay data combine method BarLayer layer = c.addBarLayer2(Chart.Overlay); // Select positive data and add it as data set with blue (6666ff) color layer.addDataSet(new ArrayMath(data).selectGEZ(null, Chart.NoValue).result(), 0x6666ff); // Select negative data and add it as data set with orange (ff6600) color layer.addDataSet(new ArrayMath(data).selectLTZ(null, Chart.NoValue).result(), 0xff6600); // Add labels to the top of the bar using 8 pt Arial Bold font. The font color is configured // to be red (0xcc3300) below zero, and blue (0x3333ff) above zero. layer.setAggregateLabelStyle("Arial Bold", 8, layer.yZoneColor(0, 0xcc3300, 0x3333ff)); // Set the labels on the x axis and use Arial Bold as the label font c.xAxis().setLabels(labels).setFontStyle("Arial Bold"); // Draw the y axis on the right of the plot area c.setYAxisOnRight(true); // Use Arial Bold as the y axis label font c.yAxis().setLabelStyle("Arial Bold"); // Add a title to the y axis c.yAxis().setTitle("Percentage"); // Add a light blue (0xccccff) zone for positive part of the plot area c.yAxis().addZone(0, 9999, 0xccccff); // Add a pink (0xffffcc) zone for negative part of the plot area c.yAxis().addZone(-9999, 0, 0xffcccc); // Output the chart viewer.Image = c.makeWebImage(Chart.PNG); // Include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("", "", "title='{xLabel}: {value}%'"); }
private void UpdatePlot(object sender, RunWorkerCompletedEventArgs e) { List <object> objlist = new List <object>(); objlist.AddRange((List <object>)e.Result); double[] depart = (double[])objlist[0]; double[] arrive = (double[])objlist[1]; double[] departVel = (double[])objlist[2]; string Plan1Name = (string)objlist[3]; string Plan2Name = (string)objlist[4]; XYChart c = new XYChart(800, 800); c.setPlotArea(75, 40, 600, 600, -1, -1, -1, c.dashLineColor(unchecked ((int)0x80000000), Chart.DotLine), -1); // When auto-scaling, use tick spacing of 40 pixels as a guideline c.yAxis().setTickDensity(40); c.xAxis().setTickDensity(40); // Add a contour layer using the given data ContourLayer layer = c.addContourLayer(depart, arrive, departVel); c.getPlotArea().moveGridBefore(layer); ColorAxis cAxis = layer.setColorAxis(700, 40, Chart.TopLeft, 400, Chart.Right); double[] colorScale = { 3, 0x090446, 3.3, 0x16366B, 3.6, 0x236890, 3.9, 0x309AB5, 4.2, 0x53C45A, 4.5, 0x77EF00, 4.8, 0xBBF70F, 5.1, 0xFFFF1E, 5.4, 0xFF8111, 5.7, 0xFF0404 }; cAxis.setColorScale(colorScale, 0x090446, 0xffffff); cAxis.setColorGradient(false); // Add a title to the color axis using 12 points Arial Bold Italic font cAxis.setTitle("Departure Velocity (km/s)", "Arial Bold Italic", 12); c.xAxis().setTitle("Departure Date (JDCT)"); c.yAxis().setTitle("Arrival Date (JDCT)"); c.addTitle("Departure Velocity from " + Plan1Name + " to " + Plan2Name); c.xAxis().setTickLength(10); c.yAxis().setTickLength(10); // Output the chart winChartViewer1.Chart = c; winChartViewer1.ImageMap = c.getHTMLImageMap(""); /* * // The data for the bar chart * double[] data = {85, 156, 179.5, 211, 123}; * * // The labels for the bar chart * string[] labels = { "Mon", "Tue", "Wed", "Thu", "Fri" }; * * XYChart c = new XYChart(250, 250); * c.setPlotArea(30, 20, 200, 200); * c.addBarLayer(data); * c.xAxis().setLabels(labels); * winChartViewer1.Chart = c; */ }
public void LoadChart(double[] data) { // The data for the line chart // double[] data0 = { 60.2, 51.7, 81.3, 48.6, 56.2, 68.9, 52.8 }; // double[] data1 = { 30.0, 32.7, 33.9, 29.5, 32.2, 28.4, 29.8 }; string[] labels = new string [31]; for (int iDay = 0; iDay < 31; iDay++) { labels[iDay] = ((int)(iDay + 1)).ToString(); } // Create a XYChart object of size 300 x 180 pixels, with a pale yellow // (0xffffc0) background, a black border, and 1 pixel 3D border effect. //834, 207 XYChart c = new XYChart(800, 190, 0xffffc0, 0x000000, 1); // Set the plotarea at (45, 35) and of size 240 x 120 pixels, with white // background. Turn on both horizontal and vertical grid lines with light // grey color (0xc0c0c0) c.setPlotArea(30, 20, 760, 150, 0xffffff, -1, -1, 0xc0c0c0, -1); // Add a legend box at (45, 12) (top of the chart) using horizontal // layout and 8 pts Arial font Set the background and border color to // Transparent. c.addLegend(45, 12, false, "", 8).setBackground(Chart.Transparent); // Add a title to the chart using 9 pts Arial Bold/white font. Use a 1 x // 2 bitmap pattern as the background. c.addTitle("Biều đồ khách môi giới theo ngày (Tháng " + calTuNgay.Value.Month.ToString() + " )", "Arial Bold", 9, 0xffffff ).setBackground(c.patternColor(new int[] { 0x004000, 0x008000 }, 2)); // Set the y axis label format to nn% c.yAxis().setLabelFormat("{value}"); // Set the labels on the x axis c.xAxis().setLabels(labels); // Add a line layer to the chart LineLayer layer = c.addLineLayer(); // Add the first line. Plot the points with a 7 pixel square symbol layer.addDataSet(data, 0xcf4040, "Số xe đón").setDataSymbol( Chart.SquareSymbol, 7); // Enable data label on the data points. Set the label format to nn%. layer.setDataLabelFormat("{value|0}"); // output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='{xLabel}: {dataSetName} {value}'"); }
//Main code for creating chart. //Note: the argument img is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, string img) { // The data for the bar chart double[] data = { 450, 560, 630, 800, 1100, 1350, 1600, 1950, 2300, 2700 }; // The labels for the bar chart string[] labels = { "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005" }; // Create a XYChart object of size 600 x 360 pixels XYChart c = new XYChart(600, 360); // Set the plotarea at (60, 40) and of size 480 x 280 pixels. Use a // vertical gradient color from light blue (eeeeff) to deep blue (0000cc) // as background. Set border and grid lines to white (ffffff). c.setPlotArea(60, 40, 480, 280, c.linearGradientColor(60, 40, 60, 280, 0xeeeeff, 0x0000cc), -1, 0xffffff, 0xffffff); // Add a title to the chart using 18pts Times Bold Italic font c.addTitle("Annual Revenue for Star Tech", "Times New Roman Bold Italic", 18); // Add a multi-color bar chart layer using the supplied data. Use glass // lighting effect with light direction from the left. c.addBarLayer3(data).setBorderColor(Chart.Transparent, Chart.glassEffect( Chart.NormalGlare, Chart.Left)); // Set the x axis labels c.xAxis().setLabels(labels); // Show the same scale on the left and right y-axes c.syncYAxis(); // Set the left y-axis and right y-axis title using 10pt Arial Bold font c.yAxis().setTitle("USD (millions)", "Arial Bold", 10); c.yAxis2().setTitle("USD (millions)", "Arial Bold", 10); // Set all axes to transparent c.xAxis().setColors(Chart.Transparent); c.yAxis().setColors(Chart.Transparent); c.yAxis2().setColors(Chart.Transparent); // Set the label styles of all axes to 8pt Arial Bold font c.xAxis().setLabelStyle("Arial Bold", 8); c.yAxis().setLabelStyle("Arial Bold", 8); c.yAxis2().setLabelStyle("Arial Bold", 8); // Output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='Year {xLabel}: US$ {value}M'"); }
// Thread th; // bool _IsKey = true; // int icount = 0; #region Function //private void addUC() //{ // Smart_FTY.UC.UC_DWMY ucMenu = new UC.UC_DWMY(5); // pnMenu.Controls.Add(ucMenu); // ucMenu.OnDWMYClick += mnBtnClick; //} //private void mnBtnClick(string ButtonCap, string ButtonCD) //{ // switch (ButtonCap) // { // case "btnClose": // this.Close(); // break; // } //} #region Chart public void createChart(WinChartViewer viewer, int per) { Chart.setLicenseCode("DEVP-2LSU-B4LX-YCTY-2DF2-77EE"); double[] d0 = new double[DayOfMonth]; double[] d1 = new double[DayOfMonth]; double[] d2 = new double[DayOfMonth]; // The data for the bar chart // Create a XYChart object of size 580 x 280 pixels XYChart c = new XYChart(1900, 500); // Set the plot area at (50, 50) and of size 500 x 200. Use two // alternative background colors (f8f8f8 and ffffff) c.setPlotArea(50, 50, 1720, 400, 0xf8f8f8, 0xffffff); // Add a legend box at (50, 25) using horizontal layout. Use 8pts Arial // as font, with transparent background. c.addLegend(c.getWidth() - 120, 25, false, "Calibri Bold", 18).setBackground(Chart.Transparent); // Set the x axis labels c.xAxis().setLabels(labels); // Draw the ticks between label positions (instead of at label positions) c.xAxis().setTickOffset(0.5); c.xAxis().setLabelStyle("Calibri Bold", 12); c.yAxis().setLabelStyle("Calibri Bold", 12); // Add a multi-bar layer with 3 data sets BarLayer layer = c.addBarLayer2(Chart.Side); ArrayMath am0 = new ArrayMath(data0); ArrayMath am1 = new ArrayMath(data1); ArrayMath am2 = new ArrayMath(data2); c.yAxis().setLinearScale(0, am2.max()); d0 = am0.mul(percentage / 100.0).result(); d1 = am1.mul(percentage / 100.0).result(); d2 = am2.mul(percentage / 100.0).result(); layer.addDataSet(d0, 0xff8080, "1 Color"); layer.addDataSet(d1, 0x008800, "2 Color"); layer.addDataSet(d2, 0x8080ff, "Total"); // Output the chart viewer.Chart = c; //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='Day:{xLabel} - {value} prs'"); }
//Main code for creating chart. //Note: the argument img is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, string img) { // The XY points for the scatter chart double[] dataX0 = { 10, 15, 6, 12, 14, 8, 13, 13, 16, 12, 10.5 }; double[] dataY0 = { 130, 150, 80, 110, 110, 105, 130, 115, 170, 125, 125 }; double[] dataX1 = { 6, 12, 4, 3.5, 7, 8, 9, 10, 12, 11, 8 }; double[] dataY1 = { 65, 80, 40, 45, 70, 80, 80, 90, 100, 105, 60 }; // Create a XYChart object of size 450 x 420 pixels XYChart c = new XYChart(450, 420); // Set the plotarea at (55, 65) and of size 350 x 300 pixels, with a // light grey border (0xc0c0c0). Turn on both horizontal and vertical // grid lines with light grey color (0xc0c0c0) c.setPlotArea(55, 65, 350, 300, -1, -1, 0xc0c0c0, 0xc0c0c0, -1); // Add a legend box at (50, 30) (top of the chart) with horizontal // layout. Use 12 pts Times Bold Italic font. Set the background and // border color to Transparent. c.addLegend(50, 30, false, "Times New Roman Bold Italic", 12 ).setBackground(Chart.Transparent); // Add a title to the chart using 18 pts Times Bold Itatic font. c.addTitle("Genetically Modified Predator", "Times New Roman Bold Italic", 18); // Add a title to the y axis using 12 pts Arial Bold Italic font c.yAxis().setTitle("Length (cm)", "Arial Bold Italic", 12); // Add a title to the x axis using 12 pts Arial Bold Italic font c.xAxis().setTitle("Weight (kg)", "Arial Bold Italic", 12); // Set the axes line width to 3 pixels c.xAxis().setWidth(3); c.yAxis().setWidth(3); // Add an orange (0xff9933) scatter chart layer, using 13 pixel diamonds // as symbols c.addScatterLayer(dataX0, dataY0, "Genetically Engineered", Chart.DiamondSymbol, 13, 0xff9933); // Add a green (0x33ff33) scatter chart layer, using 11 pixel triangles // as symbols c.addScatterLayer(dataX1, dataY1, "Natural", Chart.TriangleSymbol, 11, 0x33ff33); // Output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='[{dataSetName}] Weight = {x} kg, Length = {value} cm'"); }
//Main code for creating chart. //Note: the argument img is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, string img) { // The data for the area chart double[] data0 = { 42, 49, 33, 38, 51, 46, 29, 41, 44, 57, 59, 52, 37, 34, 51, 56, 56, 60, 70, 76, 63, 67, 75, 64, 51 }; double[] data1 = { 50, 45, 47, 34, 42, 49, 63, 62, 73, 59, 56, 50, 64, 60, 67, 67, 58, 59, 73, 77, 84, 82, 80, 84, 89 }; double[] data2 = { 61, 79, 85, 66, 53, 39, 24, 21, 37, 56, 37, 22, 21, 33, 13, 17, 4, 23, 16, 25, 9, 10, 5, 7, 16 }; string[] labels = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19","20", "21", "22", "23", "24" }; // Create a XYChart object of size 300 x 210 pixels. Set the background // to pale yellow (0xffffc0) with a black border (0x0) XYChart c = new XYChart(300, 210, 0xffffc0, 0x000000); // Set the plotarea at (50, 30) and of size 240 x 140 pixels. Use white // (0xffffff) background. c.setPlotArea(50, 30, 240, 140).setBackground(0xffffff); // Add a legend box at (50, 185) (below of plot area) using horizontal // layout. Use 8 pts Arial font with Transparent background. c.addLegend(50, 185, false, "", 8).setBackground(Chart.Transparent); // Add a title box to the chart using 8 pts Arial Bold font, with yellow // (0xffff40) background and a black border (0x0) c.addTitle("Sales Volume", "Arial Bold", 8).setBackground(0xffff40, 0); // Set the y axis label format to US$nnnn c.yAxis().setLabelFormat("US${value}"); // Set the labels on the x axis. c.xAxis().setLabels(labels); // Display 1 out of 2 labels on the x-axis. Show minor ticks for // remaining labels. c.xAxis().setLabelStep(2, 1); // Add an stack area layer with three data sets AreaLayer layer = c.addAreaLayer2(Chart.Stack); layer.addDataSet(data0, 0x4040ff, "Store #1"); layer.addDataSet(data1, 0xff4040, "Store #2"); layer.addDataSet(data2, 0x40ff40, "Store #3"); // Output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='{dataSetName} sales at hour {xLabel}: US${value}K'"); }
//Main code for creating chart. //Note: the argument chartIndex is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, int chartIndex) { // Some ChartDirector built-in symbols int[] symbols = { Chart.CircleShape, Chart.GlassSphereShape, Chart.GlassSphere2Shape, Chart.SolidSphereShape, Chart.SquareShape, Chart.DiamondShape, Chart.TriangleShape, Chart.RightTriangleShape, Chart.LeftTriangleShape, Chart.InvertedTriangleShape, Chart.StarShape(3), Chart.StarShape(4), Chart.StarShape(5), Chart.StarShape(6), Chart.StarShape(7), Chart.StarShape(8), Chart.StarShape(9), Chart.StarShape(10), Chart.PolygonShape(5), Chart.Polygon2Shape(5), Chart.PolygonShape(6), Chart.Polygon2Shape(6), Chart.Polygon2Shape(7), Chart.CrossShape(0.1), Chart.CrossShape(0.2), Chart.CrossShape(0.3), Chart.CrossShape(0.4), Chart.CrossShape(0.5), Chart.CrossShape(0.6), Chart.CrossShape(0.7), Chart.Cross2Shape(0.1), Chart.Cross2Shape(0.2), Chart.Cross2Shape(0.3), Chart.Cross2Shape(0.4), Chart.Cross2Shape(0.5), Chart.Cross2Shape(0.6), Chart.Cross2Shape(0.7), Chart.ArrowShape(), Chart.ArrowShape(45), Chart.ArrowShape( 90, 0.5), Chart.ArrowShape(135, 0.5, 0.2), Chart.ArrowShape(180,0.3, 0.2, 0.3), Chart.ArrowShape(225, 1, 0.5, 0.7),Chart.ArrowShape(270, 1, 0.5, 0.25), Chart.ArrowShape(315, 0.5, 0.5, 0),Chart.ArrowShape(30, 0.5, 0.1, 0.6), Chart.ArrowShape(210, 0.5, 0.1, 0.6),Chart.ArrowShape(330, 0.7, 0.1), Chart.ArrowShape(150, 0.7, 0.1) }; // Create a XYChart object of size 500 x 450 pixels XYChart c = new XYChart(500, 450); // Set the plotarea at (55, 40) and of size 400 x 350 pixels, with a light grey border // (0xc0c0c0). Turn on both horizontal and vertical grid lines with light grey color // (0xc0c0c0) c.setPlotArea(55, 40, 400, 350, -1, -1, 0xc0c0c0, 0xc0c0c0, -1); // Add a title to the chart using 18pt Times Bold Itatic font. c.addTitle("Built-in Symbols", "Times New Roman Bold Italic", 18); // Set the axes line width to 3 pixels c.xAxis().setWidth(3); c.yAxis().setWidth(3); // Ensure the ticks are at least 1 unit part (integer ticks) c.xAxis().setMinTickInc(1); c.yAxis().setMinTickInc(1); // Add each symbol as a separate scatter layer. for (int i = 0; i < symbols.Length; ++i) { c.addScatterLayer(new double[] { i % 7 + 1.0 }, new double[] { (int)(i / 7 + 1.0) }, "", symbols[i], 17); } // Output the chart viewer.Chart = c; //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='(x, y) = ({x}, {value})'"); }
//Main code for creating chart. //Note: the argument img is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, string img) { // The data for the area chart double[] data0 = { 42, 49, 33, 38, 51, 46, 29, 41, 44, 57, 59, 52, 37, 34, 51, 56, 56, 60, 70, 76, 63, 67, 75, 64, 51 }; double[] data1 = { 50, 45, 47, 34, 42, 49, 63, 62, 73, 59, 56, 50, 64, 60, 67, 67, 58, 59, 73, 77, 84, 82, 80, 84, 89 }; double[] data2 = { 61, 79, 85, 66, 53, 39, 24, 21, 37, 56, 37, 22, 21, 33, 13, 17, 4, 23, 16, 25, 9, 10, 5, 7, 16 }; string[] labels = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19","20", "21", "22", "23", "24" }; // Create a XYChart object of size 500 x 300 pixels XYChart c = new XYChart(500, 300); // Set the plotarea at (90, 30) and of size 300 x 240 pixels. c.setPlotArea(90, 30, 300, 240); // Add a legend box at (405, 100) c.addLegend(405, 100); // Add a title to the chart c.addTitle("Daily System Load"); // Add a title to the y axis. Draw the title upright (font angle = 0) c.yAxis().setTitle("Database\nQueries\n(per sec)").setFontAngle(0); // Set the labels on the x axis. c.xAxis().setLabels(labels); // Display 1 out of 2 labels on the x-axis. Show minor ticks for // remaining labels. c.xAxis().setLabelStep(2, 1); // Add an area layer AreaLayer layer = c.addAreaLayer(); // Draw the area layer in 3D layer.set3D(); // Add the three data sets to the area layer layer.addDataSet(data0, -1, "Server # 1"); layer.addDataSet(data1, -1, "Server # 2"); layer.addDataSet(data2, -1, "Server # 3"); // Output the chart viewer.Image = c.makeImage(); //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='{dataSetName} load at hour {xLabel}: {value} queries/sec'"); }
private void SetMonthlyGraph() { int yearFrom = Convert.ToInt32((txtYearFrom.Text.Trim() == "" ? "0" : txtYearFrom.Text.Trim())) - 543; int yearTo = Convert.ToInt32((txtYearTo.Text.Trim() == "" ? "0" : txtYearTo.Text.Trim())) - 543; int currentmonth = 0; if (yearFrom < 0) yearFrom = 0; if (yearTo < 0) yearTo = 0; int tmp = yearFrom; if (yearFrom > yearTo) { yearFrom = yearTo; yearTo = tmp; } yearFrom += 543; yearTo += 543; switch (Request["currentyear"]) { case "Á.¤.": currentmonth = 1; break; case "¡.¾.": currentmonth = 2; break; case "ÁÕ.¤.": currentmonth = 3; break; case "àÁ.Â.": currentmonth = 4; break; case "¾.¤.": currentmonth = 5; break; case "ÁÔ.Â.": currentmonth = 6; break; case "¡.¤.": currentmonth = 7; break; case "Ê.¤.": currentmonth = 8; break; case "¡.Â.": currentmonth = 9; break; case "µ.¤.": currentmonth = 10; break; case "¾.Â.": currentmonth = 11; break; case "¸.¤.": currentmonth = 12; break; } this.lnkYear.Text = GetTitle() + (yearFrom == yearTo ? "ã¹»Õ ¾.È. " + yearFrom.ToString() : " µÑé§áµè»Õ ¾.È. " + yearFrom.ToString() + "-" + yearTo.ToString()); this.lblMonth.Text = ">> à´×͹ " + Request["currentyear"].ToString(); this.pnlMonth.Visible = true; string[] labels = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }; XYChart c = new XYChart(750, 380, 15663086, 14540253, 0); string title = GetTitle() + (yearFrom == yearTo ? "ã¹»Õ ¾.È. " + yearFrom.ToString() : " µÑé§áµè»Õ ¾.È. " + yearFrom.ToString() + "-" + yearTo.ToString()); c.addTitle(title, "Tahoma Bold", 12); c.setPlotArea(70, 80, 640, 230, c.gradientColor(0, 60, 0, 350, 16777215, 11189196), -1, Chart.Transparent, 1111); c.addLegend(30, 25, false, "Tahoma Bold", 8).setBackground(Chart.Transparent); c.xAxis().setLabels(labels); c.yAxis().setTickDensity(30); c.xAxis().setLabelStyle("Tahoma", 8, 001122, 90); c.yAxis().setLabelStyle("Tahoma", 8); c.yAxis().setLabelFormat("{value|0,}"); c.xAxis().setWidth(2); c.yAxis().setWidth(2); c.yAxis().setTitle("¨Ó¹Ç¹", "Tahoma Bold", 10); c.xAxis().setTitle("Çѹ·Õè", "Tahoma Bold", 10); LineLayer layer = c.addLineLayer(); layer.setLineWidth(1); AddData(layer, yearFrom - 543, yearTo - 543, currentmonth); vwChart.Image = c.makeWebImage(Chart.PNG); vwChart.ImageMap = c.getHTMLImageMap("", "", "title='Çѹ·Õè {xLabel}\r\n{value|,} ÃÒ¡Òà ({percent}%)'"); this.pnlChart.Visible = true; }
private void SetYearlyGraph() { int yearFrom = Convert.ToInt32((txtYearFrom.Text.Trim() == "" ? "0" : txtYearFrom.Text.Trim())) - 543; int yearTo = Convert.ToInt32((txtYearTo.Text.Trim() == "" ? "0" : txtYearTo.Text.Trim())) - 543; if (yearFrom < 0) yearFrom = 0; if (yearTo < 0) yearTo = 0; int tmp = yearFrom; if (yearFrom > yearTo) { yearFrom = yearTo; yearTo = tmp; } yearFrom += 543; yearTo += 543; string[] labels = { "Á.¤.", "¡.¾.", "ÁÕ.¤.", "àÁ.Â.", "¾.¤.", "ÁÔ.Â.", "¡.¤.", "Ê.¤.", "¡.Â.", "µ.¤.", "¾.Â.", "¸.¤." }; XYChart c = new XYChart(750, 380, 15663086, 14540253, 0); string title = GetTitle() + (yearFrom == yearTo ? "ã¹»Õ ¾.È. " + yearFrom.ToString() : " µÑé§áµè»Õ ¾.È. " + yearFrom.ToString() + "-" + yearTo.ToString()); c.addTitle(title, "Tahoma Bold", 12); c.setPlotArea(70, 80, 640, 230, c.gradientColor(0, 60, 0, 350, 16777215, 11189196), -1, Chart.Transparent, 1111); c.addLegend(30, 25, false, "Tahoma Bold", 8).setBackground(Chart.Transparent); c.xAxis().setLabels(labels); c.yAxis().setTickDensity(30); c.xAxis().setLabelStyle("Tahoma", 8, 001122, 90); c.yAxis().setLabelStyle("Tahoma", 8); c.yAxis().setLabelFormat("{value|0,}"); c.xAxis().setWidth(2); c.yAxis().setWidth(2); c.yAxis().setTitle("¨Ó¹Ç¹", "Tahoma Bold", 10); c.xAxis().setTitle("à´×͹", "Tahoma Bold", 10); LineLayer layer = c.addLineLayer(); layer.setLineWidth(1); AddData(layer, yearFrom - 543, yearTo - 543); vwChart.Image = c.makeWebImage(Chart.PNG); vwChart.ImageMap = c.getHTMLImageMap(GetReportPath() + "?type=" + Request["type"] + "&warehouse=" + this.cmbWarehouse.SelectedItem.Value.ToString() + "&producttype=" + this.cmbProductType.SelectedItem.Value.ToString() + "&productgroup=" + this.cmbProductGroup.SelectedItem.Value.ToString() + "&product=" + this.cmbProduct.SelectedItem.Value.ToString() + "¤tyear={xLabel}&yearfrom=" + yearFrom.ToString() + "&yearto=" + yearTo.ToString(), "", "title='»Õ {dataSetName} à´×͹ {xLabel}\r\n{value|,} ÃÒ¡Òà ({percent}%)'"); }
private void SetDatelyProductGraph() { this.pnlMonth.Visible = false; DateTime DateFrom = this.ctlDateFrom.DateValue; DateTime DateTo = this.ctlDateTo.DateValue; string BarcodeFrom = this.txtBarcodeFrom.Text; string BarcodeTo = this.txtBarcodeTo.Text; DateTime temp = DateFrom; if (DateFrom > DateTo) { DateFrom = DateTo; DateTo = temp; } string[] labels = GetDateXLabel(DateFrom, DateTo); XYChart c = new XYChart(750, 380, 15663086, 14540253, 0); string title = GetReportTitle() + (DateFrom == DateTo ? "ã¹Çѹ·Õè " + DateFrom.ToString() : " µÑé§áµèÇѹ·Õè " + DateFrom.ToString().Substring(0, 9) + "-" + DateTo.ToString().Substring(0, 9)); c.addTitle(title, "Tahoma Bold", 12); c.setPlotArea(70, 80, 640, 230, c.gradientColor(0, 60, 0, 350, 16777215, 11189196), -1, Chart.Transparent, 1111); c.addLegend(30, 25, false, "Tahoma Bold", 8).setBackground(Chart.Transparent); c.xAxis().setLabels(labels); c.yAxis().setTickDensity(30); c.xAxis().setLabelStyle("Tahoma", 8, 001122, 90); c.yAxis().setLabelStyle("Tahoma", 8); c.yAxis().setLabelFormat("{value|0,}"); c.xAxis().setWidth(2); c.yAxis().setWidth(2); c.yAxis().setTitle("¨Ó¹Ç¹ÊÔ¹¤éÒ/Çѵ¶Ø´Ôº", "Tahoma Bold", 10); c.xAxis().setTitle("Çѹ·Õè", "Tahoma Bold", 10); c.xAxis().setLabels(labels); LineLayer layer = c.addLineLayer(); layer.setLineWidth(1); AddDateData(layer, DateFrom, DateTo, BarcodeFrom, BarcodeTo); vwChart.Image = c.makeWebImage(Chart.PNG); vwChart.ImageMap = c.getHTMLImageMap("", "", "title='{dataSetName} ã¹Çѹ·Õè {xLabel}\r\n{value|,} ÃÒ¡Òà ({percent}%)'"); }
public void createChart(WinChartViewer viewer, DateTime beginDate, Double dateRange) { //dateRange = dateRange / 3600.0; DateTime viewPortStartDate = beginDate.AddSeconds(Math.Round(viewer.ViewPortLeft * dateRange)); DateTime viewPortEndDate = viewPortStartDate.AddSeconds(Math.Round(viewer.ViewPortWidth * dateRange)); Double vpStart = Math.Round(viewer.ViewPortLeft * dateRange); Double vpEnd = vpStart + Math.Round(viewer.ViewPortWidth * dateRange); //TimeSpan hoursCalc = viewPortEndDate.Subtract(viewPortStartDate); //int hours = (hoursCalc.Days * 24) + hoursCalc.Hours; //viewPortEndDate = viewPortEndDate.AddMinutes(12 * hours); // hack to show hour labels //Double axisLowerLimit = 0 + viewer.ViewPortTop * rowRange; //Double axisUpperLimit = axisLowerLimit + viewer.ViewPortHeight * (rowRange); XYChart c = new XYChart(viewer.Width - 5, viewer.Height - 5); // Add a title to the chart c.addTitle(chartName); // Set the plotarea at (50, 20) and of size 200 x 5200 pixels c.setPlotArea(50, 20, viewer.Width - 70, viewer.Height - 75); c.setClipping(); // Add a bar chart layer using the given data if (chartOutputType.Equals(OutputType.INFO_ELEMENT)) { c.addBarLayer(chartData.HighData.ToArray(), -1, chartOutputSubType); } else { c.addScatterLayer(new double[0], new ArrayMath(chartData.HighData.ToArray()).selectNEZ(chartData.IconType.ToArray(), ChartDirector.Chart.NoValue).result(), chartOutputSubType, ChartDirector.Chart.CircleShape, 6, ChartDirector.Chart.CColor(Color.DarkOrange)); LineLayer ll = c.addStepLineLayer(); ll.addDataSet(chartData.HighData.ToArray(), ChartDirector.Chart.CColor(Color.DarkGray), ""); ll.setLineWidth(3); } c.yAxis().setTitle(chartYAxis); c.yAxis().setLinearScale(0, 1.25, 0.25); ChartDirector.Mark mark = c.yAxis().addMark(1.0, 0x008000, "Max"); mark.setLineWidth(2); mark.setDrawOnTop(false); // Set the labels on the x axis. //c.xAxis().setDateScale(viewPortStartDate, viewPortEndDate); c.xAxis().setLinearScale(vpStart, vpEnd, 1.0); c.xAxis().setMargin(10, 10); if (chartOutputType.Equals(OutputType.INFO_ELEMENT)) { ChartDirector.BarLayer bl = c.addBarLayer(); List<Double> barData = new List<Double>(); int whiteColor = ChartDirector.Chart.CColor(Color.White); int redColor = ChartDirector.Chart.CColor(Color.Red); // add marks to the bar chart so we can see if a value should be there (even if it's zero) for (int i = 0; i < chartData.RealDataAtThisPoint.Count; i++) { if (chartData.RealDataAtThisPoint[i]) { barData.Add(0.05); //c.xAxis().addMark(i, redColor); } else { barData.Add(0.0); } } bl.setBorderColor(redColor); bl.setBarWidth(0); bl.addDataSet(barData.ToArray(), whiteColor); } // begin time in chart director format String beginCD = ""+ChartDirector.Chart.CTime(beginDate); // chart director uses seconds, convert our timeincrement to seconds and add them to the start time String partialTimeString = "{=("+beginCD+"+{value}*"+ChartExplorer.TimeIncrementInSecondsString+")|"; c.xAxis().setMultiFormat(ChartDirector.Chart.StartOfDayFilter(), "<*font=bold*>"+partialTimeString+"m/d hhnn}", // show the day text once for each day ChartDirector.Chart.AllPassFilter(), partialTimeString+"hhnn}"); // military time for all others //c.xAxis().setLabels(chartData.TimeStamps.ToArray()); c.xAxis().setTitle("Time Period: Hours"); //c.xAxis().setLabelStep(4); //c.yAxis().setMultiFormat(ChartDirector.Chart.StartOfHourFilter(), "<*font=bold*>{value|w hhnn}", ChartDirector.Chart.AllPassFilter(), "{value|w hhnn}"); // output the chart try { viewer.Image = c.makeImage(); String query = "x={x}&xLabel={xLabel}&dataSet={dataSet}&dataSetName={dataSetName}&value={value}"; viewer.ImageMap = c.getHTMLImageMap(query, query); } catch (Exception) // occasionally c.makeImage(); crashes - some sort of drawing exception? // if we catch, the next redraw/resize should be fine... { } }
private void UpdatePlot(object sender, RunWorkerCompletedEventArgs e) { List<object> objlist = new List<object>(); objlist.AddRange((List<object>)e.Result); double[] depart = (double[])objlist[0]; double[] arrive = (double[])objlist[1]; double[] departVel = (double[])objlist[2]; string Plan1Name = (string)objlist[3]; string Plan2Name = (string)objlist[4]; XYChart c = new XYChart(800, 800); c.setPlotArea(75, 40, 600, 600, -1, -1, -1, c.dashLineColor(unchecked((int)0x80000000), Chart.DotLine), -1); // When auto-scaling, use tick spacing of 40 pixels as a guideline c.yAxis().setTickDensity(40); c.xAxis().setTickDensity(40); // Add a contour layer using the given data ContourLayer layer = c.addContourLayer(depart, arrive, departVel); c.getPlotArea().moveGridBefore(layer); ColorAxis cAxis = layer.setColorAxis(700, 40, Chart.TopLeft, 400, Chart.Right); double[] colorScale = { 3, 0x090446, 3.3, 0x16366B, 3.6, 0x236890, 3.9, 0x309AB5, 4.2, 0x53C45A, 4.5, 0x77EF00, 4.8, 0xBBF70F, 5.1, 0xFFFF1E, 5.4, 0xFF8111, 5.7, 0xFF0404 }; cAxis.setColorScale(colorScale, 0x090446, 0xffffff); cAxis.setColorGradient(false); // Add a title to the color axis using 12 points Arial Bold Italic font cAxis.setTitle("Departure Velocity (km/s)", "Arial Bold Italic", 12); c.xAxis().setTitle("Departure Date (JDCT)"); c.yAxis().setTitle("Arrival Date (JDCT)"); c.addTitle("Departure Velocity from " + Plan1Name + " to " + Plan2Name); c.xAxis().setTickLength(10); c.yAxis().setTickLength(10); // Output the chart winChartViewer1.Chart = c; winChartViewer1.ImageMap = c.getHTMLImageMap(""); /* // The data for the bar chart double[] data = {85, 156, 179.5, 211, 123}; // The labels for the bar chart string[] labels = { "Mon", "Tue", "Wed", "Thu", "Fri" }; XYChart c = new XYChart(250, 250); c.setPlotArea(30, 20, 200, 200); c.addBarLayer(data); c.xAxis().setLabels(labels); winChartViewer1.Chart = c; */ }
private void SetYearlyProductGraph() { this.pnlMonth.Visible = false; int yearFrom = Convert.ToInt32(this.txtYearFrom.Text == "" ? "0" : this.txtYearFrom.Text)-543; int yearTo = Convert.ToInt32(this.txtYearTo.Text == "" ? "0" : this.txtYearTo.Text)-543; string BarcodeFrom = this.txtBarcodeFrom.Text; string BarcodeTo = this.txtBarcodeTo.Text; if (yearFrom <0) yearFrom =0; if (yearTo < 0) yearTo = 0; int temp = yearFrom; if (yearFrom > yearTo) { yearFrom = yearTo; yearTo = temp; } yearFrom += 543; yearTo += 543; string[] labels = GetXLabel(yearFrom, yearTo); XYChart c = new XYChart(750, 380, 15663086, 14540253, 0); string title = GetReportTitle() + (yearFrom == yearTo ? "ã¹»Õ ¾.È. " + yearFrom.ToString() : " µÑé§áµè»Õ ¾.È. " + yearFrom.ToString() + "-" + yearTo.ToString()); c.addTitle(title, "Tahoma Bold",12); c.setPlotArea(70, 80, 640, 230, c.gradientColor(0, 60, 0, 350, 16777215, 11189196), -1, Chart.Transparent, 1111); c.addLegend(30, 25, false, "Tahoma Bold", 8).setBackground(Chart.Transparent);c.xAxis().setLabels(labels); c.yAxis().setTickDensity(30); c.xAxis().setLabelStyle("Tahoma", 8, 001122, 90); c.yAxis().setLabelStyle("Tahoma", 8); c.yAxis().setLabelFormat("{value|0,}"); c.xAxis().setWidth(2); c.yAxis().setWidth(2); c.yAxis().setTitle("¨Ó¹Ç¹ÊÔ¹¤éÒ/Çѵ¶Ø´Ôº", "Tahoma Bold", 10); c.xAxis().setTitle("»Õ ¾.È.", "Tahoma Bold", 10); LineLayer layer = c.addLineLayer(); layer.setLineWidth(1); AddData(layer, yearFrom - 543, yearTo - 543,BarcodeFrom,BarcodeTo); vwChart.Image = c.makeWebImage(Chart.PNG); vwChart.ImageMap = c.getHTMLImageMap(GetReportPath()+ "?type=" + Request["type"] + "&producegroup=" + this.cmbProduceGroup.SelectedItem.Value.ToString() + "&BarcodeFrom =" + this.txtBarcodeFrom.Text + "&BarcodeTo =" + this.txtBarcodeTo.Text+ "¤tyear={xLabel}&yearfrom=" + yearFrom.ToString() + "&yearto=" + yearTo.ToString(), "", "title='{dataSetName} ã¹»Õ {xLabel}\r\n{value|,} ÃÒ¡Òà ({percent}%)'"); }
private void SetMonthlyProductGraph() { int yearFrom = Convert.ToInt32(Request["yearfrom"]); int yearTo = Convert.ToInt32(Request["yearto"]); int currentYear = Convert.ToInt32(Request["currentyear"]); //int yearFrom = 2551; //int yearTo = 2551; //int currentYear = 2551; this.lnkYear.Text = GetReportTitle() + (yearFrom == yearTo ? "ã¹»Õ ¾.È. " + yearFrom.ToString() : " µÑé§áµè»Õ ¾.È. " + yearFrom.ToString() + "-" + yearTo.ToString()); this.lblMonth.Text = ">> »Õ ¾.È. " + currentYear.ToString(); this.pnlMonth.Visible = true; string[] labels = { "Á.¤.", "¡.¾.", "ÁÕ.¤.", "àÁ.Â.", "¾.¤.", "ÁÔ.Â.", "¡.¤.", "Ê.¤.", "¡.Â.", "µ.¤.", "¾.Â.", "¸.¤." }; XYChart c = new XYChart(750, 380, 15663086, 14540253, 0); string title = GetReportTitle() + "ã¹»Õ ¾.È. " + currentYear.ToString(); c.addTitle(title, "Tahoma Bold", 12); c.setPlotArea(70, 80, 640, 230, c.gradientColor(0, 60, 0, 350, 16777215, 11189196), -1, Chart.Transparent, 1111); c.addLegend(30, 25, false, "Tahoma Bold", 8).setBackground(Chart.Transparent); c.xAxis().setLabels(labels); c.yAxis().setTickDensity(30); c.xAxis().setLabelStyle("Tahoma", 8, 001122, 90); c.yAxis().setLabelStyle("Tahoma", 8); c.yAxis().setLabelFormat("{value|0,}"); c.xAxis().setWidth(2); c.yAxis().setWidth(2); c.yAxis().setTitle("ÃÒ¤Ò", "Tahoma Bold", 10); c.xAxis().setTitle("à´×͹", "Tahoma Bold", 10); LineLayer layer = c.addLineLayer(); layer.setLineWidth(1); AddData(layer, currentYear - 543); vwChart.Image = c.makeWebImage(Chart.PNG); vwChart.ImageMap = c.getHTMLImageMap("", "", "title='{dataSetName} ã¹à´×͹ {xLabel}\r\n{value|,} ÃÒ¡Òà ({percent}%)'"); this.pnlChart.Visible = true; }