示例#1
0
        //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[] data0 = { 100, 100, 100, 100, 100 };
            double[] data1 = { 90, 85, 85, 80, 70 };
            double[] data2 = { 80, 65, 65, 75, 45 };

            // The labels for the chart
            string[] labels = { "Population<*br*><*font=Arial*>6 millions",
                                "GDP<*br*><*font=Arial*>120 billions",     "Export<*br*><*font=Arial*>25 billions",
                                "Import<*br*><*font=Arial*>24 billions",
                                "Investments<*br*><*font=Arial*>20 billions" };

            // Create a PolarChart object of size 480 x 460 pixels. Set background color to silver,
            // with 1 pixel 3D border effect
            PolarChart c = new PolarChart(480, 460, Chart.silverColor(), 0x000000, 1);

            // Add a title to the chart using 15pt Times Bold Italic font. The title text is white
            // (ffffff) on a deep green (008000) background
            c.addTitle("Economic Growth", "Times New Roman Bold Italic", 15, 0xffffff
                       ).setBackground(0x008000);

            // Set plot area center at (240, 270), with 150 pixels radius
            c.setPlotArea(240, 270, 150);

            // Use 1 pixel width semi-transparent black (c0000000) lines as grid lines
            c.setGridColor(unchecked ((int)0xc0000000), 1, unchecked ((int)0xc0000000), 1);

            // Add a legend box at top-center of plot area (240, 35) using horizontal layout. Use
            // 10pt Arial Bold font, with silver background and 1 pixel 3D border effect.
            LegendBox b = c.addLegend(240, 35, false, "Arial Bold", 10);

            b.setAlignment(Chart.TopCenter);
            b.setBackground(Chart.silverColor(), Chart.Transparent, 1);

            // Add area layers of different colors to represent the data
            c.addAreaLayer(data0, 0xcc8880, "Year 2004");
            c.addAreaLayer(data1, 0xffd080, "Year 1994");
            c.addAreaLayer(data2, 0xa0bce0, "Year 1984");

            // Set the labels to the angular axis as spokes.
            c.angularAxis().setLabels(labels);

            // Set radial axis from 0 - 100 with a tick every 20 units
            c.radialAxis().setLinearScale(0, 100, 20);

            // Just show the radial axis as a grid line. Hide the axis labels by setting the label
            // color to Transparent
            c.radialAxis().setColors(unchecked ((int)0xc0000000), Chart.Transparent);

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='Current {label}: {value}% in {dataSetName}'");
        }
示例#2
0
        //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)
        {
            // Data for the chart
            double[] data0 = { 5, 3, 10, 4, 3, 5, 2, 5 };
            double[] data1 = { 12, 6, 17, 6, 7, 9, 4, 7 };
            double[] data2 = { 17, 7, 22, 7, 18, 13, 5, 11 };

            double[] angles = { 0, 45, 90, 135, 180, 225, 270, 315 };
            string[] labels = { "North", "North\nEast", "East", "South\nEast",
                                "South", "South\nWest", "West", "North\nWest" };

            // Create a PolarChart object of size 460 x 500 pixels, with a grey
            // (e0e0e0) background and a 1 pixel 3D border
            PolarChart c = new PolarChart(460, 500, 0xe0e0e0, 0x000000, 1);

            // Add a title to the chart at the top left corner using 15pts Arial Bold
            // Italic font. Use white text on deep blue background.
            c.addTitle("Wind Direction", "Arial Bold Italic", 15, 0xffffff
                       ).setBackground(0x000080);

            LegendBox legendBox = c.addLegend(230, 35, false, "Arial Bold", 9);

            legendBox.setAlignment(Chart.TopCenter);
            legendBox.setBackground(Chart.Transparent, Chart.Transparent, 1);

            legendBox.addKey("5 m/s or above", 0xff3333);
            legendBox.addKey("1 - 5 m/s", 0x33ff33);
            legendBox.addKey("less than 1 m/s", 0x3333ff);

            // Set plot area center at (230, 280) with radius 180 pixels and white
            // background
            c.setPlotArea(230, 280, 180, 0xffffff);

            // Set the grid style to circular grid
            c.setGridStyle(false);

            // Set angular axis as 0 - 360, with a spoke every 30 units
            c.angularAxis().setLinearScale2(0, 360, labels);

            for (int i = 0; i < angles.Length; ++i)
            {
                c.angularAxis().addZone(angles[i] - 10, angles[i] + 10, 0, data0[i],
                                        0x3333ff, 0);
                c.angularAxis().addZone(angles[i] - 10, angles[i] + 10, data0[i],
                                        data1[i], 0x33ff33, 0);
                c.angularAxis().addZone(angles[i] - 10, angles[i] + 10, data1[i],
                                        data2[i], 0xff3333, 0);
            }

            // Add an Transparent invisible layer to ensure the axis is auto-scaled
            // using the data
            c.addLineLayer(data2, Chart.Transparent);

            // Output the chart
            viewer.Image = c.makeImage();
        }
示例#3
0
        //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 = { 5.1, 2.6, 1.5, 2.2, 5.1, 4.3, 4.0, 9.0, 1.7, 8.8, 9.9,
                               9.5, 9.4, 1.8, 2.1, 2.3, 3.5, 7.7, 8.8, 6.1, 5.0, 3.1, 6.0, 4.3 };
            double[] angles0 = { 0,    15,  30,  45,  60,  75,  90, 105, 120, 135, 150, 165,
                                 180, 195, 210, 225, 240, 255, 270, 285, 300, 315, 330, 345 };

            double[] data1 = { 8.1, 2.5,   5, 5.2, 6.5, 8.5,   9, 7.6, 8.7, 6.4, 5.5, 5.4,
                               3.0, 8.7, 7.1, 8.8, 7.9, 2.2, 5.0, 4.0, 1.5, 7.5, 8.3, 9.0 };
            double[] angles1 = { 0,    15,  30,  45,  60,  75,  90, 105, 120, 135, 150, 165,
                                 180, 195, 210, 225, 240, 255, 270, 285, 300, 315, 330, 345 };

            // Create a PolarChart object of size 460 x 460 pixels
            PolarChart c = new PolarChart(460, 460);

            // Add a title to the chart at the top left corner using 15pts Arial Bold
            // Italic font
            c.addTitle2(Chart.TopLeft, "<*underline=2*>EM Field Strength",
                        "Arial Bold Italic", 15);

            // Set center of plot area at (230, 240) with radius 180 pixels
            c.setPlotArea(230, 240, 180);

            // Set the grid style to circular grid
            c.setGridStyle(false);

            // Add a legend box at the top right corner of the chart using 9 pts
            // Arial Bold font
            c.addLegend(459, 0, true, "Arial Bold", 9).setAlignment(Chart.TopRight);

            // Set angular axis as 0 - 360, with a spoke every 30 units
            c.angularAxis().setLinearScale(0, 360, 30);

            // Add a red (0xff9999) spline area layer to the chart using (data0,
            // angles0)
            c.addSplineAreaLayer(data0, 0xff9999, "Above 100MHz").setAngles(angles0);

            // Add a blue (0xff) spline line layer to the chart using (data1, angle1)
            PolarSplineLineLayer layer1 = c.addSplineLineLayer(data1, 0x0000ff,
                                                               "Below 100MHz");

            layer1.setAngles(angles1);

            // Set the line width to 3 pixels
            layer1.setLineWidth(3);

            // Output the chart
            viewer.Image = c.makeImage();

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{dataSetName} EM field at {angle} deg: {value} Watt'");
        }
示例#4
0
        //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)
        {
            // Data for the chart
            double[] data0 = { 5, 3, 10, 4, 3, 5, 2, 5 };
            double[] data1 = { 12, 6, 17, 6, 7, 9, 4, 7 };
            double[] data2 = { 17, 7, 22, 7, 18, 13, 5, 11 };

            string[] labels = { "North", "North<*br*>East", "East", "South<*br*>East",
                                "South", "South<*br*>West", "West", "North<*br*>West" };

            // Create a PolarChart object of size 460 x 500 pixels, with a grey
            // (e0e0e0) background and 1 pixel 3D border
            PolarChart c = new PolarChart(460, 500, 0xe0e0e0, 0x000000, 1);

            // Add a title to the chart at the top left corner using 15pts Arial Bold
            // Italic font. Use a wood pattern as the title background.
            c.addTitle("Polar Area Chart Demo", "Arial Bold Italic", 15
                       ).setBackground(c.patternColor("wood.png"));

            // Set center of plot area at (230, 280) with radius 180 pixels, and
            // white (ffffff) background.
            c.setPlotArea(230, 280, 180, 0xffffff);

            // Set the grid style to circular grid
            c.setGridStyle(false);

            // Add a legend box at top-center of plot area (230, 35) using horizontal
            // layout. Use 10 pts Arial Bold font, with 1 pixel 3D border effect.
            LegendBox b = c.addLegend(230, 35, false, "Arial Bold", 9);

            b.setAlignment(Chart.TopCenter);
            b.setBackground(Chart.Transparent, Chart.Transparent, 1);

            // Set angular axis using the given labels
            c.angularAxis().setLabels(labels);

            // Specify the label format for the radial axis
            c.radialAxis().setLabelFormat("{value}%");

            // Set radial axis label background to semi-transparent grey (40cccccc)
            c.radialAxis().setLabelStyle().setBackground(0x40cccccc, 0);

            // Add the data as area layers
            c.addAreaLayer(data2, -1, "5 m/s or above");
            c.addAreaLayer(data1, -1, "1 - 5 m/s");
            c.addAreaLayer(data0, -1, "less than 1 m/s");

            // Output the chart
            viewer.Image = c.makeImage();

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='[{label}] {dataSetName}: {value}%'");
        }
示例#5
0
        //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 = { 90, 60, 85, 75, 55 };
            double[] data1 = { 60, 80, 70, 80, 85 };

            // The labels for the chart
            string[] labels = { "Speed", "Reliability", "Comfort", "Safety",
                                "Efficiency" };

            // Create a PolarChart object of size 480 x 380 pixels. Set background
            // color to gold, with 1 pixel 3D border effect
            PolarChart c = new PolarChart(480, 380, Chart.goldColor(), 0x000000, 1);

            // Add a title to the chart using 15 pts Times Bold Italic font. The
            // title text is white (ffffff) on a deep blue (000080) background
            c.addTitle("Space Travel Vehicles Compared",
                       "Times New Roman Bold Italic", 15, 0xffffff).setBackground(0x000080);

            // Set plot area center at (240, 210), with 150 pixels radius, and a
            // white (ffffff) background.
            c.setPlotArea(240, 210, 150, 0xffffff);

            // Add a legend box at top right corner (470, 35) using 10 pts Arial Bold
            // font. Set the background to silver, with 1 pixel 3D border effect.
            LegendBox b = c.addLegend(470, 35, true, "Arial Bold", 10);

            b.setAlignment(Chart.TopRight);
            b.setBackground(Chart.silverColor(), Chart.Transparent, 1);

            // Add an area layer to the chart using semi-transparent blue
            // (0x806666cc). Add a blue (0x6666cc) line layer using the same data
            // with 3 pixel line width to highlight the border of the area.
            c.addAreaLayer(data0, unchecked ((int)0x806666cc), "Model Saturn");
            c.addLineLayer(data0, 0x6666cc).setLineWidth(3);

            // Add an area layer to the chart using semi-transparent red
            // (0x80cc6666). Add a red (0xcc6666) line layer using the same data with
            // 3 pixel line width to highlight the border of the area.
            c.addAreaLayer(data1, unchecked ((int)0x80cc6666), "Model Jupiter");
            c.addLineLayer(data1, 0xcc6666).setLineWidth(3);

            // Set the labels to the angular axis as spokes.
            c.angularAxis().setLabels(labels);

            // Output the chart
            viewer.Image = c.makeImage();

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='[{dataSetName}] {label}: score = {value}'");
        }
示例#6
0
        //
        // Create chart
        //
        private void createChart(RazorChartViewer viewer)
        {
            // The data for the chart
            double[] data0   = { 90, 25, 40, 55, 68, 44, 79, 85, 50 };
            double[] angles0 = { 15, 60, 110, 180, 230, 260, 260, 310, 340 };

            double[] data1   = { 80, 91, 66, 80, 92, 87 };
            double[] angles1 = { 40, 65, 88, 110, 150, 200 };

            // Create a PolarChart object of size 460 x 500 pixels, with a grey (e0e0e0) background and 1
            // pixel 3D border
            PolarChart c = new PolarChart(460, 500, 0xe0e0e0, 0x000000, 1);

            // Add a title to the chart at the top left corner using 15pt Arial Bold Italic font. Use a
            // wood pattern as the title background.
            c.addTitle("Polar Line Chart Demo", "Arial Bold Italic", 15).setBackground(c.patternColor(
                                                                                           Url.Content("~/Content/wood.png")));

            // Set center of plot area at (230, 280) with radius 180 pixels, and white (ffffff)
            // background.
            c.setPlotArea(230, 280, 180, 0xffffff);

            // Set the grid style to circular grid, with grids below the chart layers
            c.setGridStyle(false, false);

            // Add a legend box at top-center of plot area (230, 35) using horizontal layout. Use 10pt
            // Arial Bold font, with 1 pixel 3D border effect.
            LegendBox b = c.addLegend(230, 35, false, "Arial Bold", 9);

            b.setAlignment(Chart.TopCenter);
            b.setBackground(Chart.Transparent, Chart.Transparent, 1);

            // Set angular axis as 0 - 360, with a spoke every 30 units
            c.angularAxis().setLinearScale(0, 360, 30);

            // Add a blue (0xff) line layer to the chart using (data0, angle0)
            PolarLineLayer layer0 = c.addLineLayer(data0, 0x0000ff, "Close Loop Line");

            layer0.setAngles(angles0);

            // Set the line width to 2 pixels
            layer0.setLineWidth(2);

            // Use 11 pixel triangle symbols for the data points
            layer0.setDataSymbol(Chart.TriangleSymbol, 11);

            // Enable data label and set its format
            layer0.setDataLabelFormat("({value},{angle})");

            // Set the data label text box with light blue (0x9999ff) backgruond color and 1 pixel 3D
            // border effect
            layer0.setDataLabelStyle().setBackground(0x9999ff, Chart.Transparent, 1);

            // Add a red (0xff0000) line layer to the chart using (data1, angle1)
            PolarLineLayer layer1 = c.addLineLayer(data1, 0xff0000, "Open Loop Line");

            layer1.setAngles(angles1);

            // Set the line width to 2 pixels
            layer1.setLineWidth(2);

            // Use 11 pixel diamond symbols for the data points
            layer1.setDataSymbol(Chart.DiamondSymbol, 11);

            // Set the line to open loop
            layer1.setCloseLoop(false);

            // Enable data label and set its format
            layer1.setDataLabelFormat("({value},{angle})");

            // Set the data label text box with light red (0xff9999) backgruond color and 1 pixel 3D
            // border effect
            layer1.setDataLabelStyle().setBackground(0xff9999, Chart.Transparent, 1);

            // Output the chart
            viewer.Image = c.makeWebImage(Chart.PNG);

            // Include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("", "", "title='[{dataSetName}] ({radius}, {angle})'");
        }
示例#7
0
        //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)
        {
            // The data for the chart
            double[] data0   = { 6, 12.5, 18.2, 15 };
            double[] angles0 = { 45, 96, 169, 258 };
            double[] size0   = { 41, 105, 12, 20 };

            double[] data1   = { 18, 16, 11, 14 };
            double[] angles1 = { 30, 210, 240, 310 };
            double[] size1   = { 30, 45, 12, 90 };

            // Create a PolarChart object of size 460 x 460 pixels
            PolarChart c = new PolarChart(460, 460);

            // Add a title to the chart at the top left corner using 15pt Arial Bold Italic font
            c.addTitle2(Chart.TopLeft, "<*underline=2*>EM Field Strength", "Arial Bold Italic", 15);

            // Set center of plot area at (230, 240) with radius 180 pixels
            c.setPlotArea(230, 240, 180);

            // Use alternative light grey/dark grey circular background color
            c.setPlotAreaBg(0xdddddd, 0xeeeeee);

            // Set the grid style to circular grid
            c.setGridStyle(false);

            // Add a legend box at the top right corner of the chart using 9pt Arial Bold font
            c.addLegend(459, 0, true, "Arial Bold", 9).setAlignment(Chart.TopRight);

            // Set angular axis as 0 - 360, with a spoke every 30 units
            c.angularAxis().setLinearScale(0, 360, 30);

            // Set the radial axis label format
            c.radialAxis().setLabelFormat("{value} km");

            // Add a blue (0x9999ff) line layer to the chart using (data0, angle0)
            PolarLineLayer layer0 = c.addLineLayer(data0, 0x9999ff, "Cold Spot");

            layer0.setAngles(angles0);

            // Disable the line by setting its width to 0, so only the symbols are visible
            layer0.setLineWidth(0);

            // Use a circular data point symbol
            layer0.setDataSymbol(Chart.CircleSymbol, 11);

            // Modulate the symbol size by size0 to produce a bubble chart effect
            layer0.setSymbolScale(size0);

            // Add a red (0xff9999) line layer to the chart using (data1, angle1)
            PolarLineLayer layer1 = c.addLineLayer(data1, 0xff9999, "Hot Spot");

            layer1.setAngles(angles1);

            // Disable the line by setting its width to 0, so only the symbols are visible
            layer1.setLineWidth(0);

            // Use a circular data point symbol
            layer1.setDataSymbol(Chart.CircleSymbol, 11);

            // Modulate the symbol size by size1 to produce a bubble chart effect
            layer1.setSymbolScale(size1);

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{dataSetName} at ({value} km, {angle} deg)\nStrength = {z} Watt'");
        }
        //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[] data = { 5.1, 1.5, 5.1, 4.0, 1.7, 8.7, 9.4, 2.1, 3.5, 8.8, 5.0, 6.0 };

            // The labels for the chart
            string[] labels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept",
                                "Oct", "Nov", "Dec" };

            // Create a PolarChart object of size 400 x 420 pixels. with a metallic blue (9999ff)
            // background color and 1 pixel 3D border
            PolarChart c = new PolarChart(400, 420, Chart.metalColor(0x9999ff), 0x000000, 1);

            // Add a title to the chart using 16pt Arial Bold Italic font. The title text is white
            // (0xffffff) on deep blue (000080) background
            c.addTitle("Chemical Concentration", "Arial Bold Italic", 16, 0xffffff).setBackground(
                0x000080);

            // Set center of plot area at (200, 240) with radius 145 pixels. Set background color to
            // green (0x33ff33)
            c.setPlotArea(200, 240, 145, 0x33ff33);

            // Set the labels to the angular axis
            c.angularAxis().setLabels(labels);

            // Color the sector between label index = 5.5 to 7.5 as red (ff3333) zone
            c.angularAxis().addZone(5.5, 7.5, 0xff3333);

            // Color the sector between label index = 4.5 to 5.5, and also between 7.5 to 8.5, as
            // yellow (ff3333) zones
            c.angularAxis().addZone(4.5, 5.5, 0xffff00);
            c.angularAxis().addZone(7.5, 8.5, 0xffff00);

            // Set the grid style to circular grid
            c.setGridStyle(false);

            // Use semi-transparent (40ffffff) label background so as not to block the data
            c.radialAxis().setLabelStyle().setBackground(0x40ffffff, 0x40000000);

            // Add a legend box at (200, 30) top center aligned, using 9pt Arial Bold font. with a
            // black border.
            LegendBox legendBox = c.addLegend(200, 30, false, "Arial Bold", 9);

            legendBox.setAlignment(Chart.TopCenter);

            // Add legend keys to represent the red/yellow/green zones
            legendBox.addKey("Very Dry", 0xff3333);
            legendBox.addKey("Critical", 0xffff00);
            legendBox.addKey("Moderate", 0x33ff33);

            // Add a blue (0x80) line layer with line width set to 3 pixels and use purple (ff00ff)
            // cross symbols for the data points
            PolarLineLayer layer = c.addLineLayer(data, 0x000080);

            layer.setLineWidth(3);
            layer.setDataSymbol(Chart.Cross2Shape(), 15, 0xff00ff);

            // Output the chart
            viewer.Chart = c;

            // Include tool tip for the chart.
            viewer.ImageMap = layer.getHTMLImageMap("clickable", "",
                                                    "title='Concentration on {label}: {value} ppm'");
        }
示例#9
0
        //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   = { 43, 89, 76, 64, 48, 18, 92, 68, 44, 79, 71, 85 };
            double[] angles0 = { 45, 96, 169, 258, 15, 30, 330, 260, 60, 75, 110, 140 }
            ;

            double[] data1   = { 50, 91, 26, 29, 80, 53, 62, 87, 19, 40 };
            double[] angles1 = { 230, 210, 240, 310, 179, 250, 244, 199, 89, 160 };

            double[] data2   = { 88, 65, 76, 49, 80, 53 };
            double[] angles2 = { 340, 310, 340, 210, 30, 300 };

            // The labels on the angular axis (spokes)
            string[] labels = { "North", "North\nEast", "East", "South\nEast",
                                "South", "South\nWest", "West", "North\nWest" };

            // Create a PolarChart object of size 460 x 460 pixels
            PolarChart c = new PolarChart(460, 460);

            // Add a title to the chart at the top left corner using 15pts Arial Bold
            // Italic font
            c.addTitle2(Chart.TopLeft, "<*underline=2*>Plants in Wonderland",
                        "Arial Bold Italic", 15);

            // Set center of plot area at (230, 240) with radius 180 pixels
            c.setPlotArea(230, 240, 180);

            // Use alternative light grey/dark grey sector background color
            c.setPlotAreaBg(0xdddddd, 0xeeeeee, false);

            // Set the grid style to circular grid
            c.setGridStyle(false);

            // Add a legend box at the top right corner of the chart using 9 pts
            // Arial Bold font
            c.addLegend(459, 0, true, "Arial Bold", 9).setAlignment(Chart.TopRight);

            // Set angular axis as 0 - 360, either 8 spokes
            c.angularAxis().setLinearScale2(0, 360, labels);

            // Set the radial axis label format
            c.radialAxis().setLabelFormat("{value} km");

            // Add a blue (0xff) polar line layer to the chart using (data0, angle0)
            PolarLineLayer layer0 = c.addLineLayer(data0, 0x0000ff, "Immortal Weed");

            layer0.setAngles(angles0);

            layer0.setLineWidth(0);
            layer0.setDataSymbol(Chart.TriangleSymbol, 11);

            // Add a red (0xff0000) polar line layer to the chart using (data1,
            // angles1)
            PolarLineLayer layer1 = c.addLineLayer(data1, 0xff0000, "Precious Flower"
                                                   );

            layer1.setAngles(angles1);

            // Disable the line by setting its width to 0, so only the symbols are
            // visible
            layer1.setLineWidth(0);

            // Use a 11 pixel diamond data point symbol
            layer1.setDataSymbol(Chart.DiamondSymbol, 11);

            // Add a green (0x00ff00) polar line layer to the chart using (data2,
            // angles2)
            PolarLineLayer layer2 = c.addLineLayer(data2, 0x00ff00, "Magical Tree");

            layer2.setAngles(angles2);

            // Disable the line by setting its width to 0, so only the symbols are
            // visible
            layer2.setLineWidth(0);

            // Use a 9 pixel square data point symbol
            layer2.setDataSymbol(Chart.SquareSymbol, 9);

            // Output the chart
            viewer.Image = c.makeImage();

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{dataSetName} at ({value} km, {angle} deg)'");
        }
示例#10
0
        //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[] data = { 51, 15, 51, 40, 17, 87, 94, 21, 35, 88, 50, 60 };

            // The labels for the chart
            string[] labels = { "Jan", "Feb",  "Mar", "Apr", "May", "Jun", "Jul",
                                "Aug", "Sept", "Oct", "Nov", "Dec" };

            // Create a PolarChart object of size 400 x 420 pixels
            PolarChart c = new PolarChart(400, 420);

            // Set background color to a 2 pixel pattern color, with a black border
            // and 1 pixel 3D border effect
            c.setBackground(c.patternColor(new int[] { 0xffffff, 0xe0e0e0 }, 2), 0, 1);

            // Add a title to the chart using 16 pts Arial Bold Italic font. The
            // title text is white (0xffffff) on 2 pixel pattern background
            c.addTitle("Chemical Concentration", "Arial Bold Italic", 16, 0xffffff
                       ).setBackground(c.patternColor(new int[] { 0x000000, 0x000080 }, 2));

            // Set center of plot area at (200, 240) with radius 145 pixels. Set
            // background color to blue (9999ff)
            c.setPlotArea(200, 240, 145, 0x9999ff);

            // Color the region between radius = 40 to 80 as green (99ff99)
            c.radialAxis().addZone(40, 80, 0x99ff99);

            // Color the region with radius > 80 as red (ff9999)
            c.radialAxis().addZone(80, 999, 0xff9999);

            // Set the grid style to circular grid
            c.setGridStyle(false);

            // Set the radial axis label format
            c.radialAxis().setLabelFormat("{value} ppm");

            // Use semi-transparent (40ffffff) label background so as not to block
            // the data
            c.radialAxis().setLabelStyle().setBackground(0x40ffffff, 0x40000000);

            // Add a legend box at (200, 30) top center aligned, using 9 pts Arial
            // Bold font. with a black border.
            LegendBox legendBox = c.addLegend(200, 30, false, "Arial Bold", 9);

            legendBox.setAlignment(Chart.TopCenter);

            // Add legend keys to represent the red/green/blue zones
            legendBox.addKey("Under-Absorp", 0x9999ff);
            legendBox.addKey("Normal", 0x99ff99);
            legendBox.addKey("Over-Absorp", 0xff9999);

            // Add a blue (000080) spline line layer with line width set to 3 pixels
            // and using yellow (ffff00) circles to represent the data points
            PolarSplineLineLayer layer = c.addSplineLineLayer(data, 0x000080);

            layer.setLineWidth(3);
            layer.setDataSymbol(Chart.CircleShape, 11, 0xffff00);

            // Set the labels to the angular axis as spokes.
            c.angularAxis().setLabels(labels);

            // Output the chart
            viewer.Image = c.makeImage();

            // Include tool tip for the chart.
            viewer.ImageMap = layer.getHTMLImageMap("clickable", "",
                                                    "title='Concentration on {label}: {value} ppm'");
        }