Ejemplo n.º 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}'");
        }
        //
        // Load the data
        //
        private void loadData()
        {
            // In this example, we just use random numbers as data.
            RanSeries r = new RanSeries(127);

            timeStamps  = r.getDateSeries(1827, new DateTime(2007, 1, 1), 86400);
            dataSeriesA = r.getSeries2(1827, 150, -10, 10);
            dataSeriesB = r.getSeries2(1827, 200, -10, 10);
            dataSeriesC = r.getSeries2(1827, 250, -8, 8);
        }
        //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;
        }
Ejemplo n.º 4
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 XYZ data for the 3D scatter chart as 3 random data series
            RanSeries r = new RanSeries(3);

            double[] xData = r.getSeries2(20, 100, -10, 10);
            double[] yData = r.getSeries2(20, 100, -10, 10);
            double[] zData = r.getSeries2(20, 100, -10, 10);

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

            // Add a title to the chart using 20 points Times New Roman Italic font
            c.addTitle("3D Scatter Chart (2)  ", "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 scatter group to the chart using 13 pixels glass sphere symbols, in which the
            // color depends on the z value of the symbol
            ThreeDScatterGroup g = c.addScatterGroup(xData, yData, zData, "",
                                                     Chart.GlassSphere2Shape, 13, Chart.SameAsMainColor);

            // Add grey (888888) drop lines to the symbols
            g.setDropLine(0x888888);

            // Add a color axis (the legend) in which the left center is anchored at (645, 220). Set
            // the length to 200 pixels and the labels on the right side. Use smooth gradient
            // coloring.
            c.setColorAxis(645, 220, Chart.Left, 200, Chart.Right).setColorGradient();

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

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='(x={x|p}, y={y|p}, z={z|p}'");
        }
Ejemplo n.º 5
0
        //
        // Create chart
        //
        private void createChart(RazorChartViewer viewer)
        {
            // The XYZ data for the 3D scatter chart as 3 random data series
            RanSeries r = new RanSeries(0);

            double[] xData = r.getSeries2(100, 100, -10, 10);
            double[] yData = r.getSeries2(100, 0, 0, 20);
            double[] zData = r.getSeries2(100, 100, -10, 10);

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

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

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

            // Add a scatter group to the chart using 11 pixels glass sphere symbols, in which the color
            // depends on the z value of the symbol
            c.addScatterGroup(xData, yData, zData, "", Chart.GlassSphere2Shape, 11, Chart.SameAsMainColor
                              );

            // Add a color axis (the legend) in which the left center is anchored at (645, 270). Set the
            // length to 200 pixels and the labels on the right side.
            c.setColorAxis(645, 270, Chart.Left, 200, Chart.Right);

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

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

            // Include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("", "", "title='(x={x|p}, y={y|p}, z={z|p}'");
        }