예제 #1
2
        //3D scatter chart creation\\
        public void createChart(WinChartViewer viewer, int chartIndex)
        {
            int[] chartColor = new int[8] { 0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xff00ff, 0x55ffff, 0x888888, 0x111111 };
            ThreeDScatterChart c = new ThreeDScatterChart(640, 480);

            for (int k = 0; k < cltr; k++)
            {
                RanSeries r = new RanSeries(k);
                Double[] xData = new Double[1];
                Double[] yData = new Double[1];
                Double[] zData = new Double[1];
                xData = r.getSeries2(1, V[k, 0], 0, 0);
                yData = r.getSeries2(1, V[k, 1], 0, 0);
                zData = r.getSeries2(1, V[k, 2], 0, 0);
                c.addScatterGroup(xData, yData, zData, "", Chart.GlassSphere2Shape, 18, chartColor[k]);
                if (viewFuzzyBtn.Visible == true)
                {
                    for (int i = 0; i < num / 2; i++)
                    {
                        if (custCltr[i] == k)
                        {
                            xData = r.getSeries2(1, X[i, 0], 0, 0);
                            yData = r.getSeries2(1, X[i, 1], 0, 0);
                            zData = r.getSeries2(1, X[i, 2], 0, 0);
                            c.addScatterGroup(xData, yData, zData, "", Chart.GlassSphere2Shape, 12, chartColor[k]);
                        }
                    }
                    c.addScatterGroup(xData, yData, zData, rfmv[k], Chart.GlassSphere2Shape, 12, chartColor[k]);
                    c.addLegend(400, 10);
                }
                else
                {
                    for (int i = 0; i < num / 2; i++)
                    {
                        if (custCltr[i] == k)
                        {
                            xData = r.getSeries2(1, X[i, 0] * temp10, 0, 0);
                            yData = r.getSeries2(1, X[i, 1] * temp10, 0, 0);
                            zData = r.getSeries2(1, X[i, 2] * temp10, 0, 0);
                            c.addScatterGroup(xData, yData, zData, "", Chart.GlassSphere2Shape, 12, chartColor[k]);
                        }
                    }
                }
            }
            c.setPlotRegion(350, 225, 360, 360, 270);
            c.setViewAngle(15, 30);
            c.xAxis().setTitle("Recency");
            c.yAxis().setTitle("Frequency");
            c.zAxis().setTitle("Monetary");
            viewer.Chart = c;
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                "title='(x={x|p}, y={y|p}, z={z|p}'");
        }
        private void BuildChart(WinChartViewer winChartViewerResult, string[] titleXYZ, int chooseItem)
        {
            //Налаштування графіку

            // Create a ThreeDScatterChart object of size
            ThreeDScatterChart c = new ThreeDScatterChart(750, 550);

            // Add a title to the chart
            c.addTitle("3D Scatter Groups", "Times New Roman Italic", 14);

            // Set the center of the plot region at (350, 240),
            //and set width x depth x height to last three parameters
            c.setPlotRegion(300, 240, 350, 350, 350);

            // Set the elevation and rotation angles to 15 and 30 degrees
            c.setViewAngle(15, 30);

            // Add a legend box at
            c.addLegend(650, 20);


            MethodOperation methodOperation = GetDelegateOperation(chooseItem);

            double[] x;
            double[] y;
            double[] z;

            //Додавання группи для графіку по назві проекту
            foreach (KeyValuePair <string, List <BestResultGA> > group in _resultGAByNameProjectGroup)
            {
                //розмір групи
                int countElementsInGroup = group.Value.Count;
                x = new double[countElementsInGroup];
                y = new double[countElementsInGroup];
                z = new double[countElementsInGroup];
                int i = 0;
                //наповнити групу
                methodOperation(group.Value, ref x, ref y, ref z, ref i);

                //добавити групу точок
                c.addScatterGroup(x, y, z, group.Key, Chart.GlassSphere2Shape, 10);
            }

            // Set the x, y and z axis titles
            c.xAxis().setTitle(titleXYZ[0]);
            c.yAxis().setTitle(titleXYZ[1]);
            c.zAxis().setTitle(titleXYZ[2]);

            // Output the chart
            winChartViewerResult.Chart = c;

            winChartViewerResult.ImageMap = c.getHTMLImageMap("chart");//, "", "x={x}&y={y}&z={z}&dataSet={dataSet}&dataSetName={name}");
            // winChartViewerResult.ClickHotSpot += WinChartViewerResult_ClickHotSpot;
            //Зберегти графік в зображення
            //c.makeChart("chart.png");
        }
        //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 random XYZ data for the first 3D scatter group
            RanSeries r0 = new RanSeries(7);

            double[] xData0 = r0.getSeries2(100, 100, -10, 10);
            double[] yData0 = r0.getSeries2(100, 0, 0, 20);
            double[] zData0 = r0.getSeries2(100, 100, -10, 10);

            // The random XYZ data for the second 3D scatter group
            RanSeries r1 = new RanSeries(4);

            double[] xData1 = r1.getSeries2(100, 100, -10, 10);
            double[] yData1 = r1.getSeries2(100, 0, 0, 20);
            double[] zData1 = r1.getSeries2(100, 100, -10, 10);

            // The random XYZ data for the third 3D scatter group
            RanSeries r2 = new RanSeries(8);

            double[] xData2 = r2.getSeries2(100, 100, -10, 10);
            double[] yData2 = r2.getSeries2(100, 0, 0, 20);
            double[] zData2 = r2.getSeries2(100, 100, -10, 10);

            // Create a ThreeDScatterChart object of size 800 x 520 pixels
            ThreeDScatterChart c = new ThreeDScatterChart(800, 520);

            // Add a title to the chart using 20 points Times New Roman Italic font
            c.addTitle("3D Scatter Groups                    ", "Times New Roman Italic", 20);

            // Set the center of the plot region at (350, 240), and set width x depth x height to
            // 360 x 360 x 270 pixels
            c.setPlotRegion(350, 240, 360, 360, 270);

            // Set the elevation and rotation angles to 15 and 30 degrees
            c.setViewAngle(15, 30);

            // Add a legend box at (640, 180)
            c.addLegend(640, 180);

            // Add 3 scatter groups to the chart with 9 pixels glass sphere symbols of red (ff0000),
            // green (00ff00) and blue (0000ff) colors
            c.addScatterGroup(xData0, yData0, zData0, "Alpha", Chart.GlassSphere2Shape, 9, 0xff0000)
            ;
            c.addScatterGroup(xData1, yData1, zData1, "Beta", Chart.GlassSphere2Shape, 9, 0x00ff00);
            c.addScatterGroup(xData2, yData2, zData2, "Gamma", Chart.GlassSphere2Shape, 9, 0x0000ff)
            ;

            // Set the x, y and z axis titles
            c.xAxis().setTitle("X-Axis Place Holder");
            c.yAxis().setTitle("Y-Axis Place Holder");
            c.zAxis().setTitle("Z-Axis Place Holder");

            // Output the chart
            viewer.Chart = c;
        }
        //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 x coordinates for the 2 scatter groups
            DateTime[] dataX = { new DateTime(2011,                                                                                       9,  1), new DateTime(2011,                 9, 2), new DateTime(
                                     2011,                                                                                                9,  3), new DateTime(2011,                 9, 4), new DateTime(2011,  9,5), new DateTime(2011,
                                                                                                                                                                                                                  9,                    6), new DateTime(2011,   9,                7), new DateTime(2011,9,                8),new DateTime(2011,9, 9),
                                 new DateTime(2011,                                                                                       9, 10), new DateTime(2011,                 9, 11) };

            // The y and z coordinates for the first scatter group
            double[] dataY0 = { 0.4, 0.2, 0.5, 0.4, 0.7, 1.3, 1.1, 1.0, 0.6, 0.4, 0.5 };
            double[] dataZ0 = { 43, 38, 33, 23.4, 28, 36, 34, 47, 53, 45, 40 };

            // The y and z coordinates for the second scatter group
            double[] dataY1 = { 1.4, 1.0, 1.8, 1.9, 1.5, 1.0, 0.6, 0.7, 1.2, 1.7, 1.5 };
            double[] dataZ1 = { 46, 41, 33, 37, 28, 29, 34, 37, 41, 52, 50 };

            // Instead of displaying numeric values, labels are used for the y-axis
            string[] labelsY = { "Low", "Medium", "High" };

            // Create a ThreeDScatterChart object of size 760 x 520 pixels
            ThreeDScatterChart c = new ThreeDScatterChart(760, 520);

            // Add a title to the chart using 18 points Arial font
            c.addTitle("3D Scatter Chart Axis Types", "Arial", 18);

            // Set the center of the plot region at (385, 270), and set width x depth x height to
            // 480 x 240 x 240 pixels
            c.setPlotRegion(385, 270, 480, 240, 240);

            // Set the elevation and rotation angles to 30 and -10 degrees
            c.setViewAngle(30, -10);

            // Add a legend box at (380, 40) with horizontal layout. Use 9pt Arial Bold font.
            LegendBox b = c.addLegend(380, 40, false, "Arial Bold", 9);

            b.setAlignment(Chart.TopCenter);
            b.setRoundedCorners();

            // Add a scatter group to the chart using 13 pixels red (ff0000) glass sphere symbols,
            // with dotted drop lines
            ThreeDScatterGroup g0 = c.addScatterGroup(Chart.CTime(dataX), dataY0, dataZ0,
                                                      "Alpha Series", Chart.GlassSphere2Shape, 13, 0xff0000);

            g0.setDropLine(c.dashLineColor(Chart.SameAsMainColor, Chart.DotLine));

            // Add a scatter group to the chart using 13 pixels blue (00cc00) cross symbols, with
            // dotted drop lines
            ThreeDScatterGroup g1 = c.addScatterGroup(Chart.CTime(dataX), dataY1, dataZ1,
                                                      "Beta Series", Chart.Cross2Shape(), 13, 0x00cc00);

            g1.setDropLine(c.dashLineColor(Chart.SameAsMainColor, Chart.DotLine));

            // Set x-axis tick density to 50 pixels. ChartDirector auto-scaling will use this as the
            // guideline when putting ticks on the x-axis.
            c.xAxis().setTickDensity(50);

            // Set the y-axis labels
            c.yAxis().setLabels(labelsY);

            // Set label style to Arial bold for all axes
            c.xAxis().setLabelStyle("Arial Bold");
            c.yAxis().setLabelStyle("Arial Bold");
            c.zAxis().setLabelStyle("Arial Bold");

            // Set the x, y and z axis titles using deep blue (000088) 15 points Arial font
            c.xAxis().setTitle("Date/Time Axis", "Arial Italic", 15, 0x000088);
            c.yAxis().setTitle("Label\nBased\nAxis", "Arial Italic", 15, 0x000088);
            c.zAxis().setTitle("Numeric Axis", "Arial Italic", 15, 0x000088);

            // Output the chart
            viewer.Chart = c;
        }
예제 #5
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)
        {
            // getSeries2(int len, double startValue, double mindelta, double maxdelta)


            // The random XYZ data for the first 3D scatter group
            //빨강
            RanSeries r0 = new RanSeries(1);

            double[] xData0 = { 0, 0, 0, 0 }; //r0.getSeries2(10, 10, -10, 10);
            // 첫번째 값은
            double[] yData0 = { 0, 0, 0, 0 }; //r0.getSeries2(10, 0, 0, 20);
            double[] zData0 = { 0, 0, 0, 0 }; //r0.getSeries2(10, 10, -10, 10);
            //double[] xData0 = r0.getSeries2(20, 1, 0, 0); // X축
            //double[] yData0 = r0.getSeries2(20, 1, 0, 0); // y축
            //double[] zData0 = r0.getSeries2(20, 1, 0, 0); // z축



            // The random XYZ data for the second 3D scatter group
            //초록
            RanSeries r1 = new RanSeries(1);

            double[] xData1 = { 100, 100, 100, 100 };
            double[] yData1 = { 100, 100, 100, 100 };
            double[] zData1 = { 100, 100, 100, 100 };


            // The random XYZ data for the third 3D scatter group
            //파랑
            RanSeries r2 = new RanSeries(1);

            double[] xData2 = { 50, 50, 50, 50 };
            double[] yData2 = { 50, 50, 50, 50 };
            double[] zData2 = { 50, 50, 50, 50 };

            // Create a ThreeDScatterChart object of size 800 x 520 pixels
            ThreeDScatterChart c = new ThreeDScatterChart(500, 300);

            // Add a title to the chart using 20 points Times New Roman Italic font
            c.addTitle("3D Scatter Groups", "Times New Roman Italic", 20);

            // Set the center of the plot region at (350, 240), and set width x depth x height to
            // 360 x 360 x 270 pixels
            c.setPlotRegion(210, 144, 216, 216, 144);// 차트 크기조절

            // Set the elevation and rotation angles to 15 and 30 degrees
            c.setViewAngle(15, 30);

            // Add a legend box at (640, 180)
            c.addLegend(400, 180);//그룹박스 위치

            // Add 3 scatter groups to the chart with 9 pixels glass sphere symbols of red (ff0000),
            // green (00ff00) and blue (0000ff) colors
            c.addScatterGroup(xData0, yData0, zData0, "Alpha", Chart.GlassSphere2Shape, 0, 0xff0000); // 8은 좌표에 표시되는 점 크기 표시
            c.addScatterGroup(xData1, yData1, zData1, "Beta", Chart.GlassSphere2Shape, 0, 0x00ff00);
            c.addScatterGroup(xData2, yData2, zData2, "Gamma", Chart.GlassSphere2Shape, 8, 0x0000ff);



            // Set the x, y and z axis titles
            c.xAxis().setTitle("X-Axis Place Holder 가");
            c.yAxis().setTitle("Y-Axis Place Holder 나");
            c.zAxis().setTitle("Z-Axis Place Holder 다");

            // Output the chart
            viewer.Chart = c;
        }