Beispiel #1
0
        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}'");
        }
Beispiel #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)
        {
            // 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 = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };

            // 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.
            XYChart c = new XYChart(300, 180, 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(45, 35, 240, 120, 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("Server Load (Jun 01 - Jun 07)", "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(data0, 0xcf4040, "Peak").setDataSymbol(
                Chart.SquareSymbol, 7);

            // Add the second line. Plot the points with a 9 pixel dismond symbol
            layer.addDataSet(data1, 0x40cf40, "Average").setDataSymbol(
                Chart.DiamondSymbol, 9);

            // 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}%'");
        }
Beispiel #3
0
    private void AddData(LineLayer layer, int yearFrom, int yearTo, int month)
    {
        DataTable dTable = GetTableDay(yearFrom, yearTo, month);
         
        if (dTable.Rows.Count > 0)
        {
            ArrayList arrData = new ArrayList();
            ArrayList arrLabel = new ArrayList();
            string monthName = "";
            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" };

            for (int i = yearFrom; i <= yearTo; i++)
            {
                double[] d = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                DataView dv = new DataView(dTable);
                dv.RowFilter = "REQYEAR = " + i.ToString();
                for (int j = 0; j < dv.Count; j++)
                {
                    d[Convert.ToInt32(dv[j]["REQDAY"]) - 1] = Convert.ToDouble(dv[j]["QTY"]);
                }
                arrData.Add(d);

                arrLabel.Add(Convert.ToInt32(i) + 543);
            }

            //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 };

            int[] color = { 0xcf4040, 0x40cf40, 0x4040cf, 0xcfcf40, 0x40cfcf, 0xcc3535, 0x35cc35, 0x3535cc, 0xcccc35, 0x35cccc };
            int[] symbol = { Chart.SquareSymbol, Chart.DiamondSymbol, Chart.TriangleSymbol, Chart.CircleSymbol, Chart.Cross2Symbol, Chart.RightTriangleSymbol };

            for (int i = 0; i < arrData.Count; i++)
            {
                layer.addDataSet((double[])arrData[i], color[i % 10], arrLabel[i].ToString()).setDataSymbol(
                    symbol[i % 6], 7);
            }

            //Add the first line. Plot the points with a 7 pixel square symbol
            //layer.addDataSet(data0, 0xcf4040, "Peak").setDataSymbol(
            //    Chart.SquareSymbol, 7);

            //Add the second line. Plot the points with a 9 pixel dismond symbol
            //layer.addDataSet(data1, 0x40cf40, "Average").setDataSymbol(
            //    Chart.DiamondSymbol, 9);

            //Enable data label on the data points. Set the label format to nn%.
            layer.setDataLabelFormat("{value|0}");

        }
    }
Beispiel #4
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
            {}
        }
Beispiel #5
0
    private void AddData(LineLayer layer, int yearFrom, int yearTo)
    {
        DataTable dTable = null;

        switch (Request.QueryString["type"])
        {
            case "sale":
                dTable = EISReportSaleFlow.GetYearlyPublished(yearFrom, yearTo, cmbWarehouse.SelectedItem.Value, cmbProductType.SelectedItem.Value, cmbProductGroup.SelectedItem.Value, cmbProduct.SelectedItem.Value);
                break;

            case "stockin":
                dTable = EISReportStockinFlow.GetYearlyPublished(yearFrom, yearTo, cmbWarehouse.SelectedItem.Value, cmbProductType.SelectedItem.Value, cmbProductGroup.SelectedItem.Value, cmbProduct.SelectedItem.Value);
                break;

            case "stockout":
                dTable = EISReportStockoutFlow.GetYearlyPublished(yearFrom, yearTo, cmbWarehouse.SelectedItem.Value, cmbProductType.SelectedItem.Value, cmbProductGroup.SelectedItem.Value, cmbProduct.SelectedItem.Value);
                break;

            case "support":
                dTable = EISReportSupportFlow.GetYearlyPublished(yearFrom, yearTo, cmbWarehouse.SelectedItem.Value, cmbProductType.SelectedItem.Value, cmbProductGroup.SelectedItem.Value, cmbProduct.SelectedItem.Value);
                break;

            case "return":
                dTable = EISReportReturnFlow.GetYearlyPublished(yearFrom, yearTo, cmbWarehouse.SelectedItem.Value, cmbProductType.SelectedItem.Value, cmbProductGroup.SelectedItem.Value, cmbProduct.SelectedItem.Value);
                break;

            case "sendback":
                dTable = EISReportSendbackFlow.GetYearlyPublished(yearFrom, yearTo, cmbWarehouse.SelectedItem.Value, cmbProductType.SelectedItem.Value, cmbProductGroup.SelectedItem.Value, cmbProduct.SelectedItem.Value);
                break;
        }

        if (dTable.Rows.Count > 0)
        {
            ArrayList arrData = new ArrayList();
            ArrayList arrLabel = new ArrayList();
            string[] labels = { "�.�.", "�.�.", "��.�.", "��.�.", "�.�.", "��.�.", "�.�.", "�.�.", "�.�.", "�.�.", "�.�.", "�.�." };

            for (int i = yearFrom ; i <= yearTo ; i++ )
            {
                double[] d = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                DataView dv = new DataView(dTable);
                dv.RowFilter = "REQYEAR = " + i.ToString();
                for (int j = 0; j < dv.Count; j++)
                {
                    d[Convert.ToInt32(dv[j]["MON"]) - 1] = Convert.ToDouble(dv[j]["QTY"]);
                }
                arrData.Add(d);
                arrLabel.Add(Convert.ToInt32(i) + 543);
            }

            //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 };

            int[] color = { 0xcf4040, 0x40cf40, 0x4040cf, 0xcfcf40, 0x40cfcf, 0xcc3535, 0x35cc35, 0x3535cc, 0xcccc35, 0x35cccc };
            int[] symbol = { Chart.SquareSymbol, Chart.DiamondSymbol, Chart.TriangleSymbol, Chart.CircleSymbol, Chart.Cross2Symbol, Chart.RightTriangleSymbol };

            for (int i = 0; i < arrData.Count; i++)
            {
                layer.addDataSet((double[])arrData[i], color[i%10], arrLabel[i].ToString()).setDataSymbol(
                    symbol[i%6], 7);
            }

            //Add the first line. Plot the points with a 7 pixel square symbol
            //layer.addDataSet(data0, 0xcf4040, "Peak").setDataSymbol(
            //    Chart.SquareSymbol, 7);

            //Add the second line. Plot the points with a 9 pixel dismond symbol
            //layer.addDataSet(data1, 0x40cf40, "Average").setDataSymbol(
            //    Chart.DiamondSymbol, 9);

            //Enable data label on the data points. Set the label format to nn%.
            layer.setDataLabelFormat("{value|0}");

         }
    }
 private void AddDateData(LineLayer layer, DateTime DateFrom, DateTime DateTo, string BarcodeFrom, string BarcodeTo)
 {
     DataTable dTable = GetDateTable(DateFrom, DateTo, BarcodeFrom, BarcodeTo);
     for (int i = 0; i < this.chklist.Items.Count; ++i)
     {
         if (this.chklist.Items[i].Selected)
         {
             string product = this.chklist.Items[i].Value;
             foreach (DataRow dRow in dTable.Rows)
             {
                 if (Convert.ToDouble(dRow["LOID"]).ToString() == product)
                 {
                     double[] data = new double[dRow.Table.Columns.Count - 2];
                     for (int k = 0; k < dRow.Table.Columns.Count - 2; ++k)
                     {
                         data[k] = Convert.ToDouble(dRow[k + 2]);
                     }
                     layer.addDataSet(data, -1, this.chklist.Items[i].Text).setDataSymbol(Chart.DiamondShape, 9);
                 }
             }
             layer.setDataLabelFormat("{value|0}");
         }
     }
 }
    private void AddDataMonth(LineLayer layer, int yearFrom, int yearTo, string BarcodeFrom, string BarcodeTo)
    {

        DataTable dTable = GetTableMonth(yearFrom, yearTo,BarcodeFrom, BarcodeTo);

        if (dTable.Rows.Count > 0)
        {
            ArrayList arrData = new ArrayList();
            ArrayList arrLabel = new ArrayList();
            string[] labels = { "Á.¤.", "¡.¾.", "ÁÕ.¤.", "àÁ.Â.", "¾.¤.", "ÁÔ.Â.", "¡.¤.", "Ê.¤.", "¡.Â.", "µ.¤.", "¾.Â.", "¸.¤." };

            for (int i = yearFrom; i <= yearTo; i++)
            {
                double[] d = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                DataView dv = new DataView(dTable);
                dv.RowFilter = "REQYEAR = " + i.ToString();
                for (int j = 0; j < dv.Count; j++)
                {
                    d[Convert.ToInt32(dv[j]["MON"]) - 1] = Convert.ToDouble(dv[j]["QTY"]);
                }
                arrData.Add(d);
                arrLabel.Add(Convert.ToInt32(i) + 543);
            }

            int[] color = { 0xcf4040, 0x40cf40, 0x4040cf, 0xcfcf40, 0x40cfcf, 0xcc3535, 0x35cc35, 0x3535cc, 0xcccc35, 0x35cccc };
            int[] symbol = { Chart.SquareSymbol, Chart.DiamondSymbol, Chart.TriangleSymbol, Chart.CircleSymbol, Chart.Cross2Symbol, Chart.RightTriangleSymbol };

            for (int i = 0; i < arrData.Count; i++)
            {
                layer.addDataSet((double[])arrData[i], color[i % 10], arrLabel[i].ToString()).setDataSymbol(
                    symbol[i % 6], 7);
            }
            layer.setDataLabelFormat("{value|0}");

        }
    }