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}'");
    }
    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}'");
    }
Пример #3
0
        //
        // Create chart
        //
        private void createChart(RazorChartViewer viewer)
        {
            // The data for the chart
            double[] data = { 40, 15, 7, 5, 2 };

            // The labels for the chart
            string[] labels = { "Hard Disk", "PCB", "Printer", "CDROM", "Keyboard" };

            // In the pareto chart, the line data are just the accumulation of the raw data, scaled to a
            // range of 0 - 100%
            ArrayMath lineData = new ArrayMath(data);

            lineData.acc();
            double scaleFactor = lineData.max() / 100;

            if (scaleFactor == 0)
            {
                // Avoid division by zero error for zero data
                scaleFactor = 1;
            }
            lineData.div2(scaleFactor);

            // Create a XYChart object of size 480 x 300 pixels. Set background color to brushed silver,
            // with a grey (bbbbbb) border and 2 pixel 3D raised effect. Use rounded corners. Enable soft
            // drop shadow.
            XYChart c = new XYChart(400, 300, Chart.brushedSilverColor(), 0xbbbbbb, 2);

            c.setRoundedFrame();
            c.setDropShadow();

            // Add a title to the chart using 15 points Arial Italic. Set top/bottom margins to 12
            // pixels.
            ChartDirector.TextBox title = c.addTitle("Pareto Chart Demonstration", "Arial Italic", 15);
            title.setMargin2(0, 0, 12, 12);

            // Tentatively set the plotarea at (50, 40). Set the width to 100 pixels less than the chart
            // width, and the height to 80 pixels less than the chart height. Use pale grey (f4f4f4)
            // background, transparent border, and dark grey (444444) dotted grid lines.
            c.setPlotArea(50, 40, c.getWidth() - 100, c.getHeight() - 80, 0xf4f4f4, -1,
                          Chart.Transparent, c.dashLineColor(0x444444, Chart.DotLine));

            // Add a line layer for the pareto line
            LineLayer lineLayer = c.addLineLayer2();

            // Add the pareto line using deep blue (0000ff) as the color, with circle symbols
            lineLayer.addDataSet(lineData.result(), 0x0000ff).setDataSymbol(Chart.CircleShape, 9,
                                                                            0x0000ff, 0x0000ff);

            // Set the line width to 2 pixel
            lineLayer.setLineWidth(2);

            // Bind the line layer to the secondary (right) y-axis.
            lineLayer.setUseYAxis2();

            // Tool tip for the line layer
            lineLayer.setHTMLImageMap("", "", "title='Top {={x}+1} items: {value|2}%'");

            // Add a multi-color bar layer using the given data.
            BarLayer barLayer = c.addBarLayer3(data);

            // Set soft lighting for the bars with light direction from the right
            barLayer.setBorderColor(Chart.Transparent, Chart.softLighting(Chart.Right));

            // Tool tip for the bar layer
            barLayer.setHTMLImageMap("", "", "title='{xLabel}: {value} pieces'");

            // Set the labels on the x axis.
            c.xAxis().setLabels(labels);

            // Set the secondary (right) y-axis scale as 0 - 100 with a tick every 20 units
            c.yAxis2().setLinearScale(0, 100, 20);

            // Set the format of the secondary (right) y-axis label to include a percentage sign
            c.yAxis2().setLabelFormat("{value}%");

            // Set the relationship between the two y-axes, which only differ by a scaling factor
            c.yAxis().syncAxis(c.yAxis2(), scaleFactor);

            // Set the format of the primary y-axis label foramt to show no decimal point
            c.yAxis().setLabelFormat("{value|0}");

            // Add a title to the primary y-axis
            c.yAxis().setTitle("Frequency");

            // Set all axes to transparent
            c.xAxis().setColors(Chart.Transparent);
            c.yAxis().setColors(Chart.Transparent);
            c.yAxis2().setColors(Chart.Transparent);

            // Adjust the plot area size, such that the bounding box (inclusive of axes) is 10 pixels
            // from the left edge, just below the title, 10 pixels from the right edge, and 20 pixels
            // from the bottom edge.
            c.packPlotArea(10, title.getHeight(), c.getWidth() - 10, c.getHeight() - 20);

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

            // Include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("");
        }
Пример #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 = { 1700, 3900, 2900, 3800, 4100, 4600, 2900, 4100, 4400,
                               5700, 5900, 5200, 3700, 3400, 5100, 5600, 5600, 6000, 7000, 7600,
                               6300, 6700, 7500, 6400, 8800 };
            double[] data1 = { 500, 550, 670, 990, 820, 730, 800, 720, 730, 790, 860,
                               800, 840, 680, 740, 890, 680, 790, 730, 770, 840, 820, 800, 840, 670 }

            ;
            double[] data2 = { 46, 68, 35, 33, 38, 20, 12, 18, 15, 23, 30, 24, 28, 15,
                               21, 26, 46, 42, 38, 25, 23, 32, 24, 20, 25 };
            double[] data3 = { 0.84, 0.82, 0.82, 0.38, 0.25, 0.52, 0.54, 0.52, 0.38,
                               0.51, 0.46, 0.29,  0.5, 0.55, 0.47, 0.34, 0.52, 0.33,0.21, 0.3, 0.25,
                               0.15, 0.18, 0.22, 0.14 };

            // Labels for the 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 600 x 360 pixels. Use a vertical
            // gradient color from sky blue (aaccff) to white (ffffff) as background.
            // Set border to grey (888888). Use rounded corners. Enable soft drop
            // shadow.
            XYChart c = new XYChart(600, 360);

            c.setBackground(c.linearGradientColor(0, 0, 0, c.getHeight(), 0xaaccff,
                                                  0xffffff), 0x888888);
            c.setRoundedFrame();
            c.setDropShadow();

            // Add a title box to the chart using 15 pts Arial Bold Italic font. Set
            // top margin to 16 pixels.
            ChartDirector.TextBox title = c.addTitle("Multiple Axes Demonstration",
                                                     "Arial Bold Italic", 15);
            title.setMargin2(0, 0, 16, 0);

            // Set the plotarea at (100, 80) and of size 400 x 230 pixels, with white
            // (ffffff) background. Use grey #(aaaaa) dotted lines for both
            // horizontal and vertical grid lines.
            c.setPlotArea(100, 80, 400, 230, 0xffffff, -1, -1, c.dashLineColor(
                              0xaaaaaa, Chart.DotLine), -1);

            // Add a legend box with the bottom center anchored at (300, 80) (top
            // center of the plot area). Use horizontal layout, and 8 points Arial
            // Bold font. Set background and border to transparent.
            LegendBox legendBox = c.addLegend(300, 80, false, "Arial Bold", 8);

            legendBox.setAlignment(Chart.BottomCenter);
            legendBox.setBackground(Chart.Transparent, Chart.Transparent);

            // 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 a title to the x-axis
            c.xAxis().setTitle("Hour of Day");

            // Add a title on top of the primary (left) y axis.
            c.yAxis().setTitle("Power\n(Watt)").setAlignment(Chart.TopLeft2);
            // Set the axis, label and title colors for the primary y axis to red
            // (c00000) to match the first data set
            c.yAxis().setColors(0xcc0000, 0xcc0000, 0xcc0000);

            // Add a title on top of the secondary (right) y axis.
            c.yAxis2().setTitle("Load\n(Mbps)").setAlignment(Chart.TopRight2);
            // Set the axis, label and title colors for the secondary y axis to green
            // (00800000) to match the second data set
            c.yAxis2().setColors(0x008000, 0x008000, 0x008000);

            // Add the third y-axis at 50 pixels to the left of the plot area
            Axis leftAxis = c.addAxis(Chart.Left, 50);

            // Add a title on top of the third y axis.
            leftAxis.setTitle("Temp\n(C)").setAlignment(Chart.TopLeft2);
            // Set the axis, label and title colors for the third y axis to blue
            // (0000cc) to match the third data set
            leftAxis.setColors(0x0000cc, 0x0000cc, 0x0000cc);

            // Add the fouth y-axis at 50 pixels to the right of the plot area
            Axis rightAxis = c.addAxis(Chart.Right, 50);

            // Add a title on top of the fourth y axis.
            rightAxis.setTitle("Error\n(%)").setAlignment(Chart.TopRight2);
            // Set the axis, label and title colors for the fourth y axis to purple
            // (880088) to match the fourth data set
            rightAxis.setColors(0x880088, 0x880088, 0x880088);

            // Add a line layer to for the first data set using red (c00000) color,
            // with a line width of 2 pixels
            LineLayer layer0 = c.addLineLayer(data0, 0xcc0000, "Power");

            layer0.setLineWidth(2);

            // Add a line layer to for the second data set using green (00c0000)
            // color, with a line width of 2 pixels. Bind the layer to the secondary
            // y-axis.
            LineLayer layer1 = c.addLineLayer(data1, 0x008000, "Load");

            layer1.setLineWidth(2);
            layer1.setUseYAxis2();

            // Add a line layer to for the third data set using blue (0000cc) color,
            // with a line width of 2 pixels. Bind the layer to the third y-axis.
            LineLayer layer2 = c.addLineLayer(data2, 0x0000cc, "Temperature");

            layer2.setLineWidth(2);
            layer2.setUseYAxis(leftAxis);

            // Add a line layer to for the fourth data set using purple (880088)
            // color, with a line width of 2 pixels. Bind the layer to the fourth
            // y-axis.
            LineLayer layer3 = c.addLineLayer(data3, 0x880088, "Error Rate");

            layer3.setLineWidth(2);
            layer3.setUseYAxis(rightAxis);

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{dataSetName} at hour {xLabel} = {value}'");
        }
Пример #5
0
        private void INV_Chart(int percentage)
        {
            try
            {
                string[] labels   = new string[dt.Rows.Count - 1];
                double[] data_inv = new double[dt.Rows.Count - 1];
                double[] data_lt  = new double[dt.Rows.Count - 1];

                for (int x = 1; x < dt.Rows.Count; x++)
                {
                    labels[x - 1]   = dt.Rows[x]["MODEL_NM"].ToString();
                    data_inv[x - 1] = double.Parse(dt.Rows[x]["TOT_INV"].ToString());
                    data_lt[x - 1]  = double.Parse(dt.Rows[x]["TOT_LT"].ToString());
                }
                dt.Dispose();

                // Show ChartDirector
                Chart.setLicenseCode("DEVP-2LSU-B4LX-YCTY-2DF2-77EE");

                // Create a XYChart object of size 400 x 240 pixels.
                XYChart c = new XYChart(1900, 500);

                c.setBackground(0xFFFFFF);

                c.setPlotArea(50, 50, 1790, 250, c.linearGradientColor(0, 0, 0, 280, 0xffffff, 0xffffff), -1, 0xffffff, 0xffffff);
                c.xAxis().setLabels(labels).setFontAngle(45);

                c.addLegend(50, 5, false, "Calibri Bold", 15).setBackground(Chart.Transparent);

                ArrayMath am1 = new ArrayMath(data_lt);
                c.yAxis2().setLinearScale(am1.min(), am1.max(), 5000);

                LineLayer layer0 = c.addLineLayer2();

                layer0.setUseYAxis2();
                layer0.setDataLabelFormat("{value|,}");

                //dataValueINV
                layer0.addDataSet(data_lt, 0xff6347, "LeadTime (Days)").setDataSymbol(Chart.GlassSphere2Shape, 11);
                layer0.setLineWidth(3);

                BarLayer layer = c.addBarLayer(Chart.CircleShape);

                // Set the labels on the x axis.
                c.xAxis().setLabels(labels);
                c.yAxis().setLabelStyle("Calibri Bold", 10);
                c.yAxis2().setLabelStyle("Calibri Bold", 10);

                // Add a bar chart layer using the given data
                //data_lt
                ArrayMath am = new ArrayMath(dataValueINV);
                //ArrayMath am = new ArrayMath(data_inv);
                c.yAxis().setLinearScale(0, am.max() + 2);

                layer.addDataSet(am.mul(percentage / 100.0).result(), 0x00bfff, "Inventory (Prs)");
                layer.setDataLabelFormat("{value|,}");
                //layer.set3D(1);
                c.setNumberFormat(',');

                // Output the chart
                Chart_INV.Chart = c;

                //include tool tip for the chart
                Chart_INV.ImageMap = c.getHTMLImageMap("clickable", "",
                                                       "title='{xLabel}: {value} '");
            }
            catch
            {}
        }
Пример #6
0
        public void createChart4(WinChartViewer viewer, string img)
        {
            // The data for the chart
            Chart.setLicenseCode("DEVP-2LSU-B4LX-YCTY-2DF2-77EE");
            double[] data = data_w4;

            // The labels for the chart
            string[] labels = label_w4;

            // In the pareto chart, the line data are just the accumulation of the
            // raw data, scaled to a range of 0 - 100%
            ArrayMath lineData = new ArrayMath(data);

            lineData.acc();
            double scaleFactor = lineData.max() / 100;

            if (scaleFactor == 0)
            {
                // Avoid division by zero error for zero data
                scaleFactor = 1;
            }
            lineData.div2(scaleFactor);

            // Create a XYChart object of size 480 x 300 pixels. Set background color
            // to brushed silver, with a grey (bbbbbb) border and 2 pixel 3D raised
            // effect. Use rounded corners. Enable soft drop shadow.
            // XYChart c = new XYChart(400, 300, Chart.brushedSilverColor(), 0xbbbbbb, 2);
            XYChart c = new XYChart(viewer.Width, viewer.Height);

            c.setBorder(10);
            // c.setRoundedFrame();
            // c.setDropShadow();

            // Add a title to the chart using 15 points Arial Italic. Set top/bottom
            // margins to 12 pixels.

            ChartDirector.TextBox title = c.addTitle(Chart.Top, _txtTit4,
                                                     "Arial Bold", 12, 0xffffff, 0x1c86ee);
            title.setMargin2(10, 10, 6, 12);
            title.setPos(10, 3);
            title.setSize(viewer.Width - 20, 30);

            // Tentatively set the plotarea at (50, 40). Set the width to 100 pixels
            // less than the chart width, and the height to 80 pixels less than the
            // chart height. Use pale grey (f4f4f4) background, transparent border,
            // and dark grey (444444) dotted grid lines.
            //c.setPlotArea(50, 40, c.getWidth() - 100, c.getHeight() - 80, 0xf4f4f4,
            //    -1, Chart.Transparent, c.dashLineColor(0x444444, Chart.DotLine));
            c.setPlotArea(50, 50, c.getWidth() - 110, c.getHeight() - 250, 0xf4f4f4,
                          -1, Chart.Transparent, c.dashLineColor(0xffffff, Chart.Transparent));

            // Add a line layer for the pareto line
            LineLayer lineLayer = c.addLineLayer2();

            // Add the pareto line using deep blue (0000ff) as the color, with circle
            // symbols
            ArrayMath li = new ArrayMath(lineData.result());
            ArrayMath am = new ArrayMath(data);

            //lineLayer.addDataSet(li.mul(_cnt / 100.0).result(), 0x0000ff).setDataSymbol(
            //    Chart.CircleShape, 9, 0x0000ff, 0x0000ff);
            lineLayer.addDataSet(lineData.result(), 0x0000ff).setDataSymbol(
                Chart.CircleShape, 9, 0x0000ff, 0x0000ff);

            // Set the line width to 2 pixel
            lineLayer.setLineWidth(2);

            // Bind the line layer to the secondary (right) y-axis.
            lineLayer.setUseYAxis2();

            // Tool tip for the line layer
            lineLayer.setHTMLImageMap("", "",
                                      "title='Top {={x}+1} items: {value|2}%'");

            // Add a multi-color bar layer using the given data.
            BarLayer barLayer = c.addBarLayer(data, 0xfc8a8a);

            // BarLayer barLayer = c.addBarLayer(am.mul(_cnt / 100.0).result(), 0xfc8a8a);

            // Set soft lighting for the bars with light direction from the right
            barLayer.setBorderColor(Chart.Transparent, Chart.softLighting(Chart.Right
                                                                          ));


            c.xAxis().setLabelStyle("Arial Bold", 8).setFontAngle(70);
            c.yAxis().setLabelStyle("Arial Bold", 9);
            c.yAxis2().setLabelStyle("Arial Bold", 9);

            // Tool tip for the bar layer
            // barLayer.setHTMLImageMap("", "", "title='{xLabel}: {value} pieces'");

            // Set the labels on the x axis.
            c.xAxis().setLabels(labels);

            // Set the secondary (right) y-axis scale as 0 - 100 with a tick every 20
            // units
            c.yAxis2().setLinearScale(0, 100, 10);

            // Set the format of the secondary (right) y-axis label to include a
            // percentage sign
            c.yAxis2().setLabelFormat("{value}%");

            // Set the relationship between the two y-axes, which only differ by a
            // scaling factor
            c.yAxis().setLinearScale(0, 1600, 160);
            //c.yAxis().syncAxis(c.yAxis2(), scaleFactor);

            // Set the format of the primary y-axis label foramt to show no decimal
            // point
            c.yAxis().setLabelFormat("{value|0}");
            c.setNumberFormat(',');

            // Add a title to the primary y-axis
            // c.yAxis().setTitle("Frequency");



            // Set all axes to transparent
            //  c.xAxis().setColors(Chart.Transparent);
            //  c.yAxis().setColors(Chart.Transparent);
            // c.yAxis2().setColors(Chart.Transparent);

            // Adjust the plot area size, such that the bounding box (inclusive of
            // axes) is 10 pixels from the left edge, just below the title, 10 pixels
            // from the right edge, and 20 pixels from the bottom edge.
            //c.packPlotArea(10, title.getHeight(), c.getWidth() - 10, c.getHeight() -
            //    20);

            // Output the chart
            viewer.Chart = c;

            // Include tool tip for the chart
            // viewer.ImageMap = c.getHTMLImageMap("clickable");
        }