Esempio 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}'");
        }
Esempio n. 2
0
        private void createChartModel(WinChartViewer viewer, DataTable errorData, int per)
        {
            try
            {
                Chart.setLicenseCode("DEVP-2LSU-B4LX-YCTY-2DF2-77EE");
                this.chartWidth = this.Width;
                //  plottWidth = chartWidth - 80;
                double[] data = null;
                //int[] color = null;
                string[] labels = null;
                GetDataFChartModel(errorData, ref labels, ref data);

                XYChart c = new XYChart(viewer.Width, viewer.Height);
                c.setBorder(10);
                //c.setBackground(0xFFFFFF);


                c.setPlotArea(70, 90, viewer.Width - 100, viewer.Height - 270, Chart.Transparent,
                              -1, Chart.Transparent, c.dashLineColor(0xffffff, Chart.Transparent));
                ArrayMath am = new ArrayMath(data);
                viewer.BorderStyle = BorderStyle.None;


                c.yAxis().setLinearScale(0, am.max() + 10);
                BarLayer layer = c.addBarLayer(am.mul(percentage / 100.0).result(), 0x30c2f7);

                c.addTitle(" BY MODEL", "Calibri Bold", 30).setBackground(Chart.metalColor(0xff9999));

                //title.setMargin2(10, 10, 12, 12);
                layer.setBarShape(Chart.CircleShape, 0);


                layer.set3D(20, 10);

                layer.setAggregateLabelStyle("Arial Bold", 14, layer.yZoneColor(0,
                                                                                0xcc3300, 0x3333ff));

                c.xAxis().setLabels(labels);
                c.xAxis().setLabelStyle("Arial Bold", 9).setFontAngle(45);
                c.yAxis().setLabelStyle("Arial Bold", 12);

                viewer.Chart = c;
                //viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                //    "title='{xLabel}: {value}'");
            }
            catch (Exception)
            {
            }
        }
        //
        // Update controls when the view port changed
        //
        private void updateControls(WinChartViewer viewer)
        {
            // Update the start date and end date control to reflect the view port.
            startDateCtrl.Value = Chart.NTime(viewer.getValueAtViewPort("x", viewer.ViewPortLeft));
            endDateCtrl.Value   = Chart.NTime(viewer.getValueAtViewPort("x", viewer.ViewPortLeft +
                                                                        viewer.ViewPortWidth));

            // Update the scroll bar to reflect the view port position and width of the view port.
            hScrollBar1.Enabled     = winChartViewer1.ViewPortWidth < 1;
            hScrollBar1.LargeChange = (int)Math.Ceiling(winChartViewer1.ViewPortWidth *
                                                        (hScrollBar1.Maximum - hScrollBar1.Minimum));
            hScrollBar1.SmallChange = (int)Math.Ceiling(hScrollBar1.LargeChange * 0.1);
            hScrollBar1.Value       = (int)Math.Round(winChartViewer1.ViewPortLeft *
                                                      (hScrollBar1.Maximum - hScrollBar1.Minimum)) + hScrollBar1.Minimum;
        }
        //
        // Initialize the WinChartViewer
        //
        private void initChartViewer(WinChartViewer viewer)
        {
            // Set the full x range to be the duration of the data
            viewer.setFullRange("x", timeStamps[0], timeStamps[timeStamps.Length - 1]);

            // Initialize the view port to show the latest 20% of the time range
            viewer.ViewPortWidth = 0.2;
            viewer.ViewPortLeft  = 1 - viewer.ViewPortWidth;

            // Set the maximum zoom to 10 points
            viewer.ZoomInWidthLimit = 10.0 / timeStamps.Length;

            // Initially set the mouse usage to "Pointer" mode (Drag to Scroll mode)
            pointerPB.Checked = true;
        }
Esempio n. 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)
        {
            // The data for the pyramid chart
            double[] data = { 156, 123, 211, 179 };

            // The labels for the pyramid chart
            string[] labels = { "Funds", "Bonds", "Stocks", "Cash" };

            // The semi-transparent colors for the pyramid layers
            int[] colors = { 0x400000cc, 0x4066aaee, 0x40ffbb00, 0x40ee6622 };

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

            // Set the pyramid center at (220, 180), and width x height to 150 x 300 pixels
            c.setPyramidSize(220, 180, 150, 300);

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

            // Set the pyramid data and labels
            c.setData(data, labels);

            // Set the layer colors to the given colors
            c.setColors2(Chart.DataColor, colors);

            // Leave 1% gaps between layers
            c.setLayerGap(0.01);

            // Add a legend box at (320, 60), with light grey (eeeeee) background and grey (888888)
            // border. Set the top-left and bottom-right corners to rounded corners of 10 pixels
            // radius.
            LegendBox legendBox = c.addLegend(320, 60);

            legendBox.setBackground(0xeeeeee, 0x888888);
            legendBox.setRoundedCorners(10, 0, 10, 0);

            // Add labels at the center of the pyramid layers using Arial Bold font. The labels will
            // show the percentage of the layers.
            c.setCenterLabel("{percent}%", "Arial Bold");

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{label}: US$ {value}M ({percent}%)'");
        }
        //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)
        {
            // Sample data for the Box-Whisker chart. Represents the minimum, 1st quartile, medium,
            // 3rd quartile and maximum values of some quantities
            double[] Q0Data = { 40, 45, 35 };
            double[] Q1Data = { 55, 60, 50 };
            double[] Q2Data = { 62, 70, 60 };
            double[] Q3Data = { 70, 80, 65 };
            double[] Q4Data = { 80, 90, 75 };

            // The labels for the chart
            string[] labels = { "<*img=robot1.png*><*br*>Bipedal Type",
                                "<*img=robot2.png*><*br*>Wolf Type", "<*img=robot5.png*><*br*>Bird Type" };

            // Create a XYChart object of size 540 x 320 pixels
            XYChart c = new XYChart(540, 320);

            // swap the x and y axes to create a horizontal box-whisker chart
            c.swapXY();

            // Set the plotarea at (75, 25) and of size 440 x 270 pixels. Enable both horizontal and
            // vertical grids by setting their colors to grey (0xc0c0c0)
            c.setPlotArea(75, 25, 440, 270).setGridColor(0xc0c0c0, 0xc0c0c0);

            // Add a title to the chart
            c.addTitle("           Robot Shooting Accuracy Scores");

            // Set the labels on the x axis and the font to Arial Bold
            c.xAxis().setLabels(labels).setFontStyle("Arial Bold");

            // Disable x axis ticks by setting the length to 0
            c.xAxis().setTickLength(0);

            // Set the font for the y axis labels to Arial Bold
            c.yAxis().setLabelStyle("Arial Bold");

            // Add a Box Whisker layer using light blue 0x9999ff as the fill color and blue (0xcc)
            // as the line color. Set the line width to 2 pixels
            c.addBoxWhiskerLayer2(Q3Data, Q1Data, Q4Data, Q0Data, Q2Data).setLineWidth(2);

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{xLabel}: min/med/max = {min}/{med}/{max}\n Inter-quartile range: " +
                                                "{bottom} to {top}'");
        }
Esempio n. 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 area chart
            double[] data = { 30, 28, 40, 55, 75, 68, 54, 60, 50, 62, 75, 65, 75, 89, 60, 55, 53, 35,
                              50, 66, 56, 48, 52, 65, 62 };

            // The labels for the area chart
            double[] 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 320 x 320 pixels
            XYChart c = new XYChart(320, 320);

            // Swap the x and y axis to become a rotated chart
            c.swapXY();

            // Set the y axis on the top side (right + rotated = top)
            c.setYAxisOnRight();

            // Reverse the x axis so it is pointing downwards
            c.xAxis().setReverse();

            // Set the plotarea at (50, 50) and of size 200 x 200 pixels. Enable horizontal and
            // vertical grids by setting their colors to grey (0xc0c0c0).
            c.setPlotArea(50, 50, 250, 250).setGridColor(0xc0c0c0, 0xc0c0c0);

            // Add a line chart layer using the given data
            c.addAreaLayer(data, c.gradientColor(50, 0, 300, 0, 0xffffff, 0x0000ff));

            // Set the labels on the x axis. Append "m" after the value to show the unit.
            c.xAxis().setLabels2(labels, "{value} m");

            // Display 1 out of 3 labels.
            c.xAxis().setLabelStep(3);

            // Add a title to the x axis
            c.xAxis().setTitle("Depth");

            // Add a title to the y axis
            c.yAxis().setTitle("Carbon Dioxide Concentration (ppm)");

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='Carbon dioxide concentration at {xLabel}: {value} ppm'");
        }
Esempio n. 8
0
        //Main code for creating charts
        public void createChart(WinChartViewer viewer, int chartIndex)
        {
            // The data for the chart
            double[] data   = { 85, 156, 179.5, 211, 123 };
            string[] labels = { "Mon", "Tue", "Wed", "Thu", "Fri" };

            // Create a XYChart object of size 270 x 270 pixels
            XYChart c = new XYChart(270, 270);

            // Set the plot area at (40, 32) and of size 200 x 200 pixels
            PlotArea plotarea = c.setPlotArea(40, 32, 200, 200);

            // Set the background style based on the input parameter
            if (chartIndex == 0)
            {
                // Has wallpaper image
                c.setWallpaper("@/images/tile.png");
            }
            else if (chartIndex == 1)
            {
                // Use a background image as the plot area background
                plotarea.setBackground2("@/images/bg.png");
            }
            else if (chartIndex == 2)
            {
                // Use white (0xffffff) and grey (0xe0e0e0) as two alternate plotarea background
                // colors
                plotarea.setBackground(0xffffff, 0xe0e0e0);
            }
            else
            {
                // Use a dark background palette
                c.setColors(Chart.whiteOnBlackPalette);
            }

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

            // Add a color bar layer using the given data. Use a 1 pixel 3D border for the bars.
            c.addBarLayer3(data).setBorderColor(-1, 1);

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='Revenue for {xLabel}: US${value}K'");
        }
Esempio n. 9
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 bar chart
            double[] data = { 85, 156, 179, 211, 123, 189, 166 };

            // The labels for the bar chart
            string[] labels = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };

            // The colors for the bars
            int[] colors = { 0x5588bb, 0x66bbbb, 0xaa6644, 0x99bb55, 0xee9944, 0x444466, 0xbb5555 };

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

            // Set default text color to dark grey (0x333333)
            c.setColor(Chart.TextColor, 0x333333);

            // Add a title box using grey (0x555555) 24pt Arial font
            c.addTitle("Multi-Color Bar Chart", "Arial", 24, 0x555555);

            // Set the plotarea at (70, 60) and of size 500 x 300 pixels, with transparent
            // background and border and light grey (0xcccccc) horizontal grid lines
            c.setPlotArea(70, 60, 500, 300, Chart.Transparent, -1, Chart.Transparent, 0xcccccc);

            // Set the x and y axis stems to transparent and the label font to 12pt Arial
            c.xAxis().setColors(Chart.Transparent);
            c.yAxis().setColors(Chart.Transparent);
            c.xAxis().setLabelStyle("Arial", 12);
            c.yAxis().setLabelStyle("Arial", 12);

            // Add a multi-color bar chart layer with transparent border using the given data
            c.addBarLayer3(data, colors).setBorderColor(Chart.Transparent);

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

            // For the automatic y-axis labels, set the minimum spacing to 40 pixels.
            c.yAxis().setTickDensity(40);

            // Add a title to the y axis using dark grey (0x555555) 14pt Arial font
            c.yAxis().setTitle("Y-Axis Title Placeholder", "Arial", 14, 0x555555);

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='{xLabel}: ${value}M'");
        }
Esempio n. 10
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 area chart
            double[] data0 = { 42, 49, 33, 38, 51, 46, 29, 41, 44, 57, 59, 52, 37, 34, 51, 56, 56,
                               60, 70, 76, 63, 67, 75, 64, 51 };
            double[] data1 = { 50, 55, 47, 34, 42, 49, 63, 62, 73, 59, 56, 50, 64, 60, 67, 67, 58,
                               59, 73, 77, 84, 82, 80, 84, 89 };
            double[] data2 = { 87, 89, 85, 66, 53, 39, 24, 21, 37, 56, 37, 22, 21, 33, 13, 17, 4, 23,
                               16, 25,  9, 10,  5,  7, 6 };
            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 350 x 230 pixels
            XYChart c = new XYChart(350, 230);

            // Set the plotarea at (50, 30) and of size 250 x 150 pixels.
            c.setPlotArea(50, 30, 250, 150);

            // Add a legend box at (55, 0) (top of the chart) using 8pt Arial Font. Set background
            // and border to Transparent.
            c.addLegend(55, 0, false, "", 8).setBackground(Chart.Transparent);

            // Add a title to the x axis
            c.xAxis().setTitle("Network Load for Jun 12");

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

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

            // Display 1 out of 2 labels on the x-axis. Show minor ticks for remaining labels.
            c.xAxis().setLabelStep(2, 1);

            // Add three area layers, each representing one data set. The areas are drawn in
            // semi-transparent colors.
            c.addAreaLayer(data2, unchecked ((int)0x808080ff), "Server #1", 3);
            c.addAreaLayer(data0, unchecked ((int)0x80ff0000), "Server #2", 3);
            c.addAreaLayer(data1, unchecked ((int)0x8000ff00), "Server #3", 3);

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{dataSetName} load at hour {xLabel}: {value} MBytes'");
        }
Esempio n. 11
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 (x, y) coordinates of the starting point of the vectors
            double[] dataX = { 20, 40, 60,  80, 100, 20, 40, 60, 80, 100, 20, 40, 58, 62, 80, 100, 20,
                               40, 60, 80, 100,  20, 40, 60, 80, 100 };
            double[] dataY = { 20, 20, 20, 20,  20,  40,  40,  40, 40, 40, 60, 60, 60, 60, 60, 60, 80,
                               80, 80, 80, 80, 100, 100, 100, 100, 100 };

            // The lengths (radii) and directions (angles) of the vectors
            double[] dataR = { 6, 6, 9, 6, 6, 6, 9, 12, 9, 6, 9, 12, 12, 12, 12, 9, 6, 9, 12, 9, 6,
                               6, 6, 9, 6, 6 };
            double[] dataA = { -45,   -30,   0,  30,  45,  -60,  -45,   0,  45, 60, -90, -90, -90, 90, 90, 90,
                               -120, -135, 180, 135, 120, -135, -150, 180, 150, 135 };

            // Create a XYChart object of size 450 x 390 pixels
            XYChart c = new XYChart(450, 390);

            // Set the plotarea at (55, 40) and of size 350 x 300 pixels, with a light grey border
            // (0xc0c0c0). Turn on both horizontal and vertical grid lines with light grey color
            // (0xc0c0c0)
            c.setPlotArea(55, 40, 350, 300, -1, -1, 0xc0c0c0, 0xc0c0c0, -1);

            // Add a title to the chart using 18pt Times Bold Itatic font.
            c.addTitle("Vector Chart Demonstration", "Times New Roman Bold Italic", 18);

            // Add a title to the y axis using 12pt Arial Bold Italic font
            c.yAxis().setTitle("Y Axis Title", "Arial Bold Italic", 12);

            // Add a title to the x axis using 12pt Arial Bold Italic font
            c.xAxis().setTitle("X Axis Title", "Arial Bold Italic", 12);

            // Set the axes line width to 3 pixels
            c.xAxis().setWidth(3);
            c.yAxis().setWidth(3);

            // Add a vector layer to the chart using blue (0000CC) color, with vector arrow size set
            // to 11 pixels
            c.addVectorLayer(dataX, dataY, dataR, dataA, Chart.YAxisScale, 0x0000cc).setArrowHead(11
                                                                                                  );

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='Vector at ({x}, {value}): Length = {len}, Angle = {dir} deg'");
        }
Esempio n. 12
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 value to display on the meter
            double value = 27.48;

            // Create an AngularMeter object of size 200 x 115 pixels, with silver
            // background color, black border, 2 pixel 3D border border and rounded
            // corners
            AngularMeter m = new AngularMeter(200, 115, Chart.silverColor(),
                                              0x000000, 2);

            m.setRoundedFrame();

            // Set the meter center at (100, 100), with radius 85 pixels, and span
            // from -90 to +90 degress (semi-circle)
            m.setMeter(100, 100, 85, -90, 90);

            // Meter scale is 0 - 100, with major tick every 20 units, minor tick
            // every 10 units, and micro tick every 5 units
            m.setScale(0, 100, 20, 10, 5);

            // Set 0 - 60 as green (66FF66) zone
            m.addZone(0, 60, 0, 85, 0x66ff66);

            // Set 60 - 80 as yellow (FFFF33) zone
            m.addZone(60, 80, 0, 85, 0xffff33);

            // Set 80 - 100 as red (FF6666) zone
            m.addZone(80, 100, 0, 85, 0xff6666);

            // Add a text label centered at (100, 60) with 12 pts Arial Bold font
            m.addText(100, 60, "PSI", "Arial Bold", 12, Chart.TextColor, Chart.Center
                      );

            // Add a text box at the top right corner of the meter showing the value
            // formatted to 2 decimal places, using white text on a black background,
            // and with 1 pixel 3D depressed border
            m.addText(156, 8, m.formatValue(value, "2"), "Arial", 8, 0xffffff
                      ).setBackground(0x000000, 0, -1);

            // Add a semi-transparent blue (40666699) pointer with black border at
            // the specified value
            m.addPointer(value, 0x40666699, 0x000000);

            // Output the chart
            viewer.Image = m.makeImage();
        }
Esempio n. 13
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}'");
        }
Esempio n. 14
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 values to display on the meter
            double value0 = 30.99;
            double value1 = 45.35;
            double value2 = 77.64;

            // Create an LinearMeter object of size 250 x 75 pixels, using silver
            // background with a 2 pixel black 3D depressed border.
            LinearMeter m = new LinearMeter(250, 75, Chart.silverColor(), 0, -2);

            // Set the scale region top-left corner at (15, 25), with size of 220 x
            // 20 pixels. The scale labels are located on the top (implies horizontal
            // meter)
            m.setMeter(15, 25, 220, 20, Chart.Top);

            // Set meter scale from 0 - 100, with a tick every 10 units
            m.setScale(0, 100, 10);

            // Set 0 - 50 as green (99ff99) zone, 50 - 80 as yellow (ffff66) zone,
            // and 80 - 100 as red (ffcccc) zone
            m.addZone(0, 50, 0x99ff99);
            m.addZone(50, 80, 0xffff66);
            m.addZone(80, 100, 0xffcccc);

            // Add deep red (000080), deep green (008000) and deep blue (800000)
            // pointers to reflect the values
            m.addPointer(value0, 0x000080);
            m.addPointer(value1, 0x008000);
            m.addPointer(value2, 0x800000);

            // Add a label at bottom-left (10, 68) using Arial Bold/8 pts/red
            // (c00000)
            m.addText(10, 68, "Temp C", "Arial Bold", 8, 0xc00000, Chart.BottomLeft);

            // Add three text boxes to show the values in this meter
            m.addText(148, 70, m.formatValue(value0, "2"), "Arial", 8, 0x6666ff,
                      Chart.BottomRight).setBackground(0, 0, -1);
            m.addText(193, 70, m.formatValue(value1, "2"), "Arial", 8, 0x33ff33,
                      Chart.BottomRight).setBackground(0, 0, -1);
            m.addText(238, 70, m.formatValue(value2, "2"), "Arial", 8, 0xff3333,
                      Chart.BottomRight).setBackground(0, 0, -1);

            // Output the chart
            viewer.Image = m.makeImage();
        }
Esempio n. 15
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)
        {
            // Create an AngularMeter object of size 300 x 300 pixels with transparent background
            AngularMeter m = new AngularMeter(300, 300, Chart.Transparent);

            // Set the default text and line colors to white (0xffffff)
            m.setColor(Chart.TextColor, 0xffffff);
            m.setColor(Chart.LineColor, 0xffffff);

            // Center at (150, 150), scale radius = 128 pixels, scale angle 0 to 360 degrees
            m.setMeter(150, 150, 128, 0, 360);

            // Add a black (0x000000) circle with radius 148 pixels as background
            m.addRing(0, 148, 0x000000);

            // Add a ring between radii 139 and 147 pixels using the silver color with a light grey
            // (0xcccccc) edge as border
            m.addRing(139, 147, Chart.silverColor(), 0xcccccc);

            // Meter scale is 0 - 100, with major/minor/micro ticks every 10/5/1 units
            m.setScale(0, 100, 10, 5, 1);

            // Set the scale label style to 16pt Arial Italic. Set the major/minor/micro tick
            // lengths to 13/10/7 pixels pointing inwards, and their widths to 2/1/1 pixels.
            m.setLabelStyle("Arial Italic", 16);
            m.setTickLength(-13, -10, -7);
            m.setLineWidth(0, 2, 1, 1);

            // Add a semi-transparent blue (0x7f6666ff) pointer using the default shape
            m.addPointer(25, 0x7f6666ff, 0x6666ff);

            // Add a semi-transparent red (0x7fff6666) pointer using the arrow shape
            m.addPointer(9, 0x7fff6666, 0xff6666).setShape(Chart.ArrowPointer2);

            // Add a semi-transparent yellow (0x7fffff66) pointer using another arrow shape
            m.addPointer(51, 0x7fffff66, 0xffff66).setShape(Chart.ArrowPointer);

            // Add a semi-transparent green (0x7f66ff66) pointer using the line shape
            m.addPointer(72, 0x7f66ff66, 0x66ff66).setShape(Chart.LinePointer);

            // Add a semi-transparent grey (0x7fcccccc) pointer using the pencil shape
            m.addPointer(85, 0x7fcccccc, 0xcccccc).setShape(Chart.PencilPointer);

            // Output the chart
            viewer.Chart = m;
        }
Esempio n. 16
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 pyramid chart
            double[] data = { 156, 123, 211, 179 };

            // The labels for the pyramid chart
            string[] labels = { "Corporate Tax", "Working Capital", "Re-investment",
                                "Dividend" };

            // The colors for the pyramid layers
            int[] colors = { 0x66aaee, 0xeebb22, 0xcccccc, 0xcc88ff };

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

            // Set the pyramid center at (200, 180), and width x height to 150 x 300
            // pixels
            c.setPyramidSize(200, 180, 150, 300);

            // Set the elevation to 15 degrees
            c.setViewAngle(15);

            // Set the pyramid data and labels
            c.setData(data, labels);

            // Set the layer colors to the given colors
            c.setColors2(Chart.DataColor, colors);

            // Leave 1% gaps between layers
            c.setLayerGap(0.01);

            // Add labels at the center of the pyramid layers using Arial Bold font.
            // The labels will show the percentage of the layers.
            c.setCenterLabel("{percent}%", "Arial Bold");

            // Add labels at the right side of the pyramid layers using Arial Bold
            // font. The labels will have two lines showing the layer name and value.
            c.setRightLabel("{label}\nUS$ {value}M", "Arial Bold");

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{label}: US$ {value}M ({percent}%)'");
        }
Esempio n. 17
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 XY points for the scatter chart
            double[] dataX = { 200, 400, 300, 250, 500 };
            double[] dataY = { 40, 100, 50, 150, 250 };

            // The custom symbols for the points
            string[] symbols = { "@/images/robot1.png", "@/images/robot2.png", "@/images/robot3.png",
                                 "@/images/robot4.png", "@/images/robot5.png" };

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

            // Set the plotarea at (55, 40) and of size 350 x 300 pixels, with a light grey border
            // (0xc0c0c0). Turn on both horizontal and vertical grid lines with light grey color
            // (0xc0c0c0)
            c.setPlotArea(55, 40, 350, 300, -1, -1, 0xc0c0c0, 0xc0c0c0, -1);

            // Add a title to the chart using 18pt Times Bold Itatic font.
            c.addTitle("Battle Robots", "Times New Roman Bold Italic", 18);

            // Add a title to the y axis using 12pt Arial Bold Italic font
            c.yAxis().setTitle("Speed (km/s)", "Arial Bold Italic", 12);

            // Add a title to the y axis using 12pt Arial Bold Italic font
            c.xAxis().setTitle("Range (km)", "Arial Bold Italic", 12);

            // Set the axes line width to 3 pixels
            c.xAxis().setWidth(3);
            c.yAxis().setWidth(3);

            // Add each point of the data as a separate scatter layer, so that they can have a
            // different symbol
            for (int i = 0; i < dataX.Length; ++i)
            {
                c.addScatterLayer(new double[] { dataX[i] }, new double[] { dataY[i] }).getDataSet(0
                                                                                                   ).setDataSymbol2(symbols[i]);
            }

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='Range = {x} km, Speed = {value} km/s'");
        }
        private void drawFullChart(WinViewPortControl vpc, WinChartViewer viewer)
        {
            // Create an XYChart object of size 640 x 60 pixels
            XYChart c = new XYChart(640, 60);

            // Set the plotarea with the same horizontal position as that in the main chart for alignment.
            c.setPlotArea(55, 0, c.getWidth() - 80, c.getHeight() - 1, 0xc0d8ff, -1, 0x888888,
                          Chart.Transparent, 0xffffff);

            // Set the x axis stem to transparent and the label font to 10pt Arial
            c.xAxis().setColors(Chart.Transparent);
            c.xAxis().setLabelStyle("Arial", 10);

            // Put the x-axis labels inside the plot area by setting a negative label gap. Use
            // setLabelAlignment to put the label at the right side of the tick.
            c.xAxis().setLabelGap(-1);
            c.xAxis().setLabelAlignment(1);

            // Set the y axis stem and labels to transparent (that is, hide the labels)
            c.yAxis().setColors(Chart.Transparent, Chart.Transparent);

            // Add a line layer for the lines with fast line mode enabled
            LineLayer layer = c.addLineLayer();

            layer.setFastLineMode();

            // Now we add the 3 data series to a line layer, using the color red (0xff3333), green
            // (0x008800) and blue (0x3333cc)
            layer.setXData(timeStamps);
            layer.addDataSet(dataSeriesA, 0xff3333);
            layer.addDataSet(dataSeriesB, 0x008800);
            layer.addDataSet(dataSeriesC, 0x3333cc);

            // The x axis scales should reflect the full range of the view port
            c.xAxis().setDateScale(viewer.getValueAtViewPort("x", 0), viewer.getValueAtViewPort("x", 1));

            // For the automatic x-axis labels, set the minimum spacing to 75 pixels.
            c.xAxis().setTickDensity(75);

            // For the auto-scaled y-axis, as we hide the labels, we can disable axis rounding. This can
            // make the axis scale fit the data tighter.
            c.yAxis().setRounding(false, false);

            // Output the chart
            vpc.Chart = c;
        }
Esempio n. 19
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 bar chart
            double[] data0  = { 100, 125, 245, 147, 67 };
            double[] data1  = { 85, 156, 179, 211, 123 };
            double[] data2  = { 97, 87, 56, 267, 157 };
            string[] labels = { "Mon", "Tue", "Wed", "Thu", "Fri" };

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

            // Add a title to the chart using 10 pt Arial font
            c.addTitle("         Average Weekday Network Load", "", 10);

            // Set the plot area at (50, 25) and of size 320 x 180. Use two
            // alternative background colors (0xffffc0 and 0xffffe0)
            c.setPlotArea(50, 25, 320, 180, 0xffffc0, 0xffffe0);

            // Add a legend box at (55, 18) using horizontal layout. Use 8 pt Arial
            // font, with transparent background
            c.addLegend(55, 18, false, "", 8).setBackground(Chart.Transparent);

            // Add a title to the y-axis
            c.yAxis().setTitle("Throughput (MBytes Per Hour)");

            // Reserve 20 pixels at the top of the y-axis for the legend box
            c.yAxis().setTopMargin(20);

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

            // Add a multi-bar layer with 3 data sets and 3 pixels 3D depth
            BarLayer layer = c.addBarLayer2(Chart.Side, 3);

            layer.addDataSet(data0, 0xff8080, "Server #1");
            layer.addDataSet(data1, 0x80ff80, "Server #2");
            layer.addDataSet(data2, 0x8080ff, "Server #3");

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{dataSetName} on {xLabel}: {value} MBytes/hour'");
        }
Esempio n. 20
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 pie chart
            double[] data = { 18, 45, 28 };

            // The labels for the pie chart
            string[] labels = { "Marble", "Wood", "Granite" };

            // The icons for the sectors
            string[] texture = { "marble3.png", "wood.png", "rock.png" };

            // Create a PieChart object of size 400 x 330 pixels, with a metallic
            // green (88EE88) background, black border and 1 pixel 3D border effect
            PieChart c = new PieChart(400, 330, Chart.metalColor(0x88ee88), 0x000000,
                                      1);

            // Set donut center at (200, 160), and outer/inner radii as 120/60 pixels
            c.setDonutSize(200, 160, 120, 60);

            // Add a title box using 15 pts Times Bold Italic font and metallic deep
            // green (008000) background color
            c.addTitle("Material Composition", "Times New Roman Bold Italic", 15
                       ).setBackground(Chart.metalColor(0x008000));

            // Set the pie data and the pie labels
            c.setData(data, labels);

            // Set the colors of the sectors to the 3 texture patterns
            c.setColor(Chart.DataColor + 0, c.patternColor2(texture[0]));
            c.setColor(Chart.DataColor + 1, c.patternColor2(texture[1]));
            c.setColor(Chart.DataColor + 2, c.patternColor2(texture[2]));

            // Draw the pie in 3D with a 3D depth of 30 pixels
            c.set3D(30);

            // Use 12 pts Arial Bold Italic as the sector label font
            c.setLabelStyle("Arial Bold Italic", 12);

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{label}: {value}kg ({percent}%)'");
        }
        //Main code for creating charts
        public void createChart(WinChartViewer viewer, int chartIndex)
        {
            // The value to display on the meter
            double value = 74.25;

            // Bar colors of the meters
            int[] barColor = { 0x2299ff, 0x00ee00, 0xaa66ee, 0xff7711 };

            // Create a LinearMeter object of size 70 x 240 pixels with very light grey (0xeeeeee)
            // backgruond and a grey (0xaaaaaa) 3-pixel thick rounded frame
            LinearMeter m = new LinearMeter(70, 240, 0xeeeeee, 0xaaaaaa);

            m.setRoundedFrame(Chart.Transparent);
            m.setThickFrame(3);

            // This example demonstrates putting the text labels at the left or right side of the
            // meter scale, and putting the color scale on the same side as the labels or on
            // opposite side.
            int[] alignment     = { Chart.Left, Chart.Left, Chart.Right, Chart.Right };
            int[] meterXPos     = { 28, 38, 12, 21 };
            int[] labelGap      = { 2, 12, 10, 2 };
            int[] colorScalePos = { 53, 28, 36, 10 };

            // Configure the position of the meter scale and which side to put the text labels
            m.setMeter(meterXPos[chartIndex], 18, 20, 205, alignment[chartIndex]);

            // Set meter scale from 0 - 100, with a tick every 10 units
            m.setScale(0, 100, 10);

            // To put the color scale on the same side as the text labels, we need to increase the
            // gap between the labels and the meter scale to make room for the color scale
            m.setLabelPos(false, labelGap[chartIndex]);

            // Add a smooth color scale to the meter
            double[] smoothColorScale = { 0, 0x0000ff, 25, 0x0088ff, 50, 0x00ff00, 75, 0xdddd00, 100,
                                          0xff0000 };
            m.addColorScale(smoothColorScale, colorScalePos[chartIndex], 6);

            // Add a bar from 0 to value with glass effect and 4 pixel rounded corners
            m.addBar(0, value, barColor[chartIndex], Chart.glassEffect(Chart.NormalGlare, Chart.Left
                                                                       ), 4);

            // Output the chart
            viewer.Chart = m;
        }
Esempio n. 22
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)
        {
            // Coordinates of the starting points of the vectors
            double[] radius = { 5,   5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5, 10, 10, 10, 10, 10, 10, 10, 10,
                                10, 10, 10, 10, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 20, 20, 20, 20, 20,
                                20, 20, 20, 20, 20, 20, 20, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25 };
            double[] angle = { 0,    30,  60,  90, 120, 150, 180, 210, 240, 270, 300, 330,   0,  30,  60,  90,
                               120, 150, 180, 210, 240, 270, 300, 330,   0,  30,  60,  90, 120, 150, 180, 210,240, 270,
                               300, 330,   0,  30,  60,  90, 120, 150, 180, 210, 240, 270, 300, 330,   0,  30, 60,  90,120,
                               150, 180, 210, 240, 270, 300, 330 };

            // Magnitude and direction of the vectors
            double[] magnitude = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
                                   4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1,
                                   1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
            double[] direction = { 60,   90, 120, 150, 180, 210, 240, 270, 300, 330,   0,  30,  60,  90,
                                   120, 150, 180, 210, 240, 270, 300, 330,   0,  30,  60,  90, 120, 150,180, 210, 240, 270,
                                   300, 330,   0,  30,  60,  90, 120, 150, 180, 210, 240, 270, 300, 330, 0,  30,  60,  90,120,
                                   150, 180, 210, 240, 270, 300, 330,   0, 30 };

            // 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.addTitle("Polar Vector Chart Demonstration", "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);

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

            // Add a polar vector layer to the chart with blue (0000ff) vectors
            c.addVectorLayer(radius, angle, magnitude, direction, Chart.RadialAxisScale, 0x0000ff);

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='Vector at ({value}, {angle} deg): Length = {len}, Angle = {dir} deg'");
        }
Esempio n. 23
0
        //
        // Draw track cursor when mouse is moving over plotarea, and update image map if necessary
        //
        private void winChartViewer1_MouseMovePlotArea(object sender, MouseEventArgs e)
        {
            WinChartViewer viewer = (WinChartViewer)sender;

            // Draw crosshair track cursor
            crossHair((XYChart)viewer.Chart, viewer.PlotAreaMouseX, viewer.PlotAreaMouseY);
            viewer.updateDisplay();

            // Hide the track cursor when the mouse leaves the plot area
            viewer.removeDynamicLayer("MouseLeavePlotArea");

            // Update image map if necessary. If the mouse is still dragging, the chart is still
            // updating and not confirmed, so there is no need to set up the image map.
            if (!viewer.IsMouseDragging)
            {
                updateImageMap(viewer);
            }
        }
Esempio n. 24
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)
        {
            // Sample data for the Box-Whisker chart. Represents the minimum, 1st
            // quartile, medium, 3rd quartile and maximum values of some quantities
            double[] Q0Data = { 40, 45, 40, 30, 20, 50, 25, 44 };
            double[] Q1Data = { 55, 60, 50, 40, 38, 60, 51, 60 };
            double[] Q2Data = { 62, 70, 60, 50, 48, 70, 62, 70 };
            double[] Q3Data = { 70, 80, 65, 60, 53, 78, 69, 76 };
            double[] Q4Data = { 80, 90, 75, 70, 60, 85, 80, 84 };

            // The labels for the chart
            string[] labels = { "Group A", "Group B", "Group C", "Group D", "Group E",
                                "Group F", "Group G", "Group H" };

            // Create a XYChart object of size 550 x 250 pixels
            XYChart c = new XYChart(550, 250);

            // Set the plotarea at (50, 25) and of size 450 x 200 pixels. Enable both
            // horizontal and vertical grids by setting their colors to grey
            // (0xc0c0c0)
            c.setPlotArea(50, 25, 450, 200).setGridColor(0xc0c0c0, 0xc0c0c0);

            // Add a title to the chart
            c.addTitle("Computer Vision Test Scores");

            // Set the labels on the x axis and the font to Arial Bold
            c.xAxis().setLabels(labels).setFontStyle("Arial Bold");

            // Set the font for the y axis labels to Arial Bold
            c.yAxis().setLabelStyle("Arial Bold");

            // Add a Box Whisker layer using light blue 0x9999ff as the fill color
            // and blue (0xcc) as the line color. Set the line width to 2 pixels
            c.addBoxWhiskerLayer(Q3Data, Q1Data, Q4Data, Q0Data, Q2Data, 0x9999ff,
                                 0x0000cc).setLineWidth(2);

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{xLabel}: min/med/max = {min}/{med}/{max}\nInter-quartile " +
                                                "range: {bottom} to {top}'");
        }
Esempio n. 25
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, int minvalue, int maxvalue)
        {
            double[] xData = { minvalue };
            double[] yData = { minvalue };
            double[] zData = { minvalue };

            double[] xData2 = { maxvalue };
            double[] yData2 = { maxvalue };
            double[] zData2 = { maxvalue };
            // 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, 0, Chart.DataColor);
            c.addScatterGroup(xData2, yData2, zData2, "", Chart.GlassSphere2Shape, 0, Chart.DataColor);

            for (int i = 0; i < AP.Count; i++)
            {
                c.addScatterGroup(AP[i].Xd, AP[i].Yd, AP[i].Zd, "", Chart.GlassSphere2Shape, 5, Chart.DataColor);
            }
            // 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.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='(x={x|p}, y={y|p}, z={z|p}'");
        }
        /// <summary>
        /// init the chart viewer
        /// </summary>
        /// <param name="viewer">the instance of the viewer to init</param>
        private void initChartViewer(WinChartViewer viewer)
        {
            // set the x range
            // if (dataLoaded)
            {
                Console.WriteLine("data loaded in init chart viewer, index lenght: " + index.Length);
                viewer.setFullRange("x", index[0], index[index.Length - 1]);
                // init the view prot to show the latest 20% of the result

                viewer.ViewPortWidth = 0.2;
                viewer.ViewPortLeft  = 1 - viewer.ViewPortWidth;

                // set the maximum zoom to 10 points
                viewer.ZoomInWidthLimit = 10.0 / index.Length;
            }

            // init the set the mouse usage to "pointer" mode (drag to sroll mode)
            viewer.Dock = DockStyle.Fill;
        }
Esempio n. 27
0
        //
        // Update the chart and the viewport periodically
        //
        private void chartUpdateTimer_Tick(object sender, EventArgs e)
        {
            WinChartViewer viewer = winChartViewer1;

            if (currentIndex > 0)
            {
                //
                // As we added more data, we may need to update the full range.
                //

                double startDate = timeStamps[0];
                double endDate   = timeStamps[currentIndex - 1];

                // Use the initialFullRange if this is sufficient.
                double duration = endDate - startDate;
                if (duration < initialFullRange)
                {
                    endDate = startDate + initialFullRange;
                }

                // Update the full range to reflect the actual duration of the data. In this case,
                // if the view port is viewing the latest data, we will scroll the view port as new
                // data are added. If the view port is viewing historical data, we would keep the
                // axis scale unchanged to keep the chart stable.
                int updateType = Chart.ScrollWithMax;
                if (viewer.ViewPortLeft + viewer.ViewPortWidth < 0.999)
                {
                    updateType = Chart.KeepVisibleRange;
                }
                bool axisScaleHasChanged = viewer.updateFullRangeH("x", startDate, endDate, updateType);

                // Set the zoom in limit as a ratio to the full range
                viewer.ZoomInWidthLimit = zoomInLimit / (viewer.getValueAtViewPort("x", 1) -
                                                         viewer.getValueAtViewPort("x", 0));

                // Trigger the viewPortChanged event to update the display if the axis scale has
                // changed or if new data are added to the existing axis scale.
                if (axisScaleHasChanged || (duration < initialFullRange))
                {
                    viewer.updateViewPort(true, false);
                }
            }
        }
Esempio n. 28
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 bar chart
            double[] data = { 85, 156, 179.5, 211, 123 };

            // The labels for the bar chart
            string[] labels = { "Mon", "Tue", "Wed", "Thu", "Fri" };

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

            // Add a title to the chart using 14pt Times Bold Italic font
            c.addTitle("Weekly Server Load", "Times New Roman Bold Italic", 14);

            // Set the plotarea at (45, 40) and of 300 x 160 pixels in size. Use alternating light
            // grey (f8f8f8) / white (ffffff) background.
            c.setPlotArea(45, 40, 300, 160, 0xf8f8f8, 0xffffff);

            // Add a multi-color bar chart layer
            BarLayer layer = c.addBarLayer3(data);

            // Set layer to 3D with 10 pixels 3D depth
            layer.set3D(10);

            // Set bar shape to circular (cylinder)
            layer.setBarShape(Chart.CircleShape);

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

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

            // Add a title to the x axis
            c.xAxis().setTitle("Work Week 25");

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='{xLabel}: {value} MBytes'")
            ;
        }
Esempio n. 29
0
        //Main code for creating charts
        public void createChart(WinChartViewer viewer, int chartIndex)
        {
            // The data for the pie chart
            double[] data = { 25, 18, 15, 12, 8, 30, 35 };

            // The labels for the pie chart
            string[] labels = { "Labor", "Licenses", "Taxes", "Legal", "Insurance", "Facilities",
                                "Production" };

            // Create a PieChart object of size 280 x 240 pixels
            PieChart c = new PieChart(280, 240);

            // Set the center of the pie at (140, 130) and the radius to 80 pixels
            c.setPieSize(140, 130, 80);

            // Add a title to the pie to show the start angle and direction
            if (chartIndex == 0)
            {
                c.addTitle("Start Angle = 0 degrees\nDirection = Clockwise");
            }
            else
            {
                c.addTitle("Start Angle = 90 degrees\nDirection = AntiClockwise");
                c.setStartAngle(90, false);
            }

            // Draw the pie in 3D
            c.set3D();

            // Set the pie data and the pie labels
            c.setData(data, labels);

            // Explode the 1st sector (index = 0)
            c.setExplode(0);

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{label}: US${value}K ({percent}%)'");
        }
Esempio n. 30
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[] data = { 30, 28, 40, 55, 75, 68, 54, 60, 50, 62, 75, 65, 75, 91,
                              60, 55, 53, 35, 50, 66, 56, 48, 52, 65, 62 };

            // The labels for the line 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 300 x 280 pixels
            XYChart c = new XYChart(300, 280);

            // Set the plotarea at (45, 30) and of size 200 x 200 pixels
            c.setPlotArea(45, 30, 200, 200);

            // Add a title to the chart using 12 pts Arial Bold Italic font
            c.addTitle("Daily Server Utilization", "Arial Bold Italic", 12);

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

            // Add a title to the x axis
            c.xAxis().setTitle("June 12, 2001");

            // Add a blue (0x6666ff) 3D line chart layer using the give data
            c.addLineLayer(data, 0x6666ff).set3D();

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

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='Hour {xLabel}: {value} MBytes'");
        }
Esempio n. 31
0
        public void CreateChart(WinChartViewer viewer, GameCategoriesModel vModel)
        {
            // The data for the chart
            double[] data =
            {
                vModel.Card,
                vModel.Arcade,
                vModel.Matching,
                vModel.Action,
                vModel.Strategy,
                vModel.Word,
                vModel.Puzzles,
                vModel.Crossword,
                vModel.MeTVGames,
                vModel.Quizzes,
                vModel.Casino,
                vModel.BrainGames,
                vModel.Puzzle,
                vModel.Solitaire
            };

            // The labels for the chart
            string[] labels = { "Card", "Arcade", "Matching", "Action", "Strategy", "Word", "Puzzles", "Crossword", "MeTVGames", "Quizzes", "Casino", "BrainGames", "Puzzle", "Solitaire" };

            // Create a PolarChart object of size 450 x 350 pixels
            PolarChart c = new PolarChart(347, 238);

            // Set center of plot area at (225, 185) with radius 150 pixels
            c.setPlotArea(173, 115, 80);

            // Add an area layer to the polar chart
            c.addAreaLayer(data, 0x9999ff);

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

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='{label}: score = {value}'");
        }
Esempio n. 32
0
        public MainWindow()
        {
            InitializeComponent();
            data = new Data();

            //  We choose desktop as default directory as all Windows platforms should have one
            string directory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Data Sample";

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            directory_txtBox.Text = directory;

            //  This is necessary as Chart Director does not fully support WPF yet.... :(
            chartViewer = new WinChartViewer();
            chartViewer.ChartSizeMode = WinChartSizeMode.StretchImage;
            this.windowsFormsHost.Child = chartViewer;
        }
Esempio n. 33
0
        public void createChart(WinChartViewer viewer, DateTime beginDate, Double dateRange)
        {
            //dateRange = dateRange / 3600.0;
            DateTime viewPortStartDate = beginDate.AddSeconds(Math.Round(viewer.ViewPortLeft * dateRange));
            DateTime viewPortEndDate = viewPortStartDate.AddSeconds(Math.Round(viewer.ViewPortWidth * dateRange));
            Double vpStart = Math.Round(viewer.ViewPortLeft * dateRange);
            Double vpEnd = vpStart + Math.Round(viewer.ViewPortWidth * dateRange);
            //TimeSpan hoursCalc = viewPortEndDate.Subtract(viewPortStartDate);
            //int hours = (hoursCalc.Days * 24) + hoursCalc.Hours;
            //viewPortEndDate = viewPortEndDate.AddMinutes(12 * hours); // hack to show hour labels
            //Double axisLowerLimit = 0 + viewer.ViewPortTop * rowRange;
            //Double axisUpperLimit = axisLowerLimit + viewer.ViewPortHeight * (rowRange);

            XYChart c = new XYChart(viewer.Width - 5, viewer.Height - 5);
            // Add a title to the chart
            c.addTitle(chartName);

             // Set the plotarea at (50, 20) and of size 200 x 5200 pixels
            c.setPlotArea(50, 20, viewer.Width - 70, viewer.Height - 75);
            c.setClipping();

            // Add a bar chart layer using the given data
            if (chartOutputType.Equals(OutputType.INFO_ELEMENT))
            {
                c.addBarLayer(chartData.HighData.ToArray(), -1, chartOutputSubType);
            }
            else
            {
                c.addScatterLayer(new double[0],
                new ArrayMath(chartData.HighData.ToArray()).selectNEZ(chartData.IconType.ToArray(), ChartDirector.Chart.NoValue).result(),
                     chartOutputSubType, ChartDirector.Chart.CircleShape, 6, ChartDirector.Chart.CColor(Color.DarkOrange));

                LineLayer ll = c.addStepLineLayer();
                ll.addDataSet(chartData.HighData.ToArray(), ChartDirector.Chart.CColor(Color.DarkGray), "");
                ll.setLineWidth(3);
            }

            c.yAxis().setTitle(chartYAxis);
            c.yAxis().setLinearScale(0, 1.25, 0.25);
            ChartDirector.Mark mark = c.yAxis().addMark(1.0, 0x008000, "Max");
            mark.setLineWidth(2);
            mark.setDrawOnTop(false);

            // Set the labels on the x axis.
            //c.xAxis().setDateScale(viewPortStartDate, viewPortEndDate);
            c.xAxis().setLinearScale(vpStart, vpEnd, 1.0);
            c.xAxis().setMargin(10, 10);

            if (chartOutputType.Equals(OutputType.INFO_ELEMENT))
            {
                ChartDirector.BarLayer bl = c.addBarLayer();
                List<Double> barData = new List<Double>();
                int whiteColor = ChartDirector.Chart.CColor(Color.White);
                int redColor = ChartDirector.Chart.CColor(Color.Red);
                // add marks to the bar chart so we can see if a value should be there (even if it's zero)
                for (int i = 0; i < chartData.RealDataAtThisPoint.Count; i++)
                {
                    if (chartData.RealDataAtThisPoint[i])
                    {
                        barData.Add(0.05);
                        //c.xAxis().addMark(i, redColor);
                    }
                    else
                    {
                        barData.Add(0.0);
                    }
                        
                }
                bl.setBorderColor(redColor);
                bl.setBarWidth(0);
                bl.addDataSet(barData.ToArray(), whiteColor);
            }
                              
            // begin time in chart director format
            String beginCD = ""+ChartDirector.Chart.CTime(beginDate);
            // chart director uses seconds, convert our timeincrement to seconds and add them to the start time
            String partialTimeString = "{=("+beginCD+"+{value}*"+ChartExplorer.TimeIncrementInSecondsString+")|";
            c.xAxis().setMultiFormat(ChartDirector.Chart.StartOfDayFilter(), "<*font=bold*>"+partialTimeString+"m/d hhnn}", // show the day text once for each day
                                     ChartDirector.Chart.AllPassFilter(), partialTimeString+"hhnn}"); // military time for all others
            
            //c.xAxis().setLabels(chartData.TimeStamps.ToArray());
            c.xAxis().setTitle("Time Period: Hours");
            //c.xAxis().setLabelStep(4);
            //c.yAxis().setMultiFormat(ChartDirector.Chart.StartOfHourFilter(), "<*font=bold*>{value|w hhnn}", ChartDirector.Chart.AllPassFilter(), "{value|w hhnn}");


            // output the chart
            try
            {
                viewer.Image = c.makeImage();
                String query = "x={x}&xLabel={xLabel}&dataSet={dataSet}&dataSetName={dataSetName}&value={value}";
                viewer.ImageMap = c.getHTMLImageMap(query, query);
            }
            catch (Exception) // occasionally c.makeImage(); crashes - some sort of drawing exception?
                              // if we catch, the next redraw/resize should be fine...
            {

            }
        }
Esempio n. 34
0
 private void drawChart(WinChartViewer viewer)
 {
     Chart.IChartExplorer chart = viewer.Tag as Chart.IChartExplorer;
     if (chart != null)
         chart.createChart(viewer, beginDate, dateRange);
 }
Esempio n. 35
0
        private void hotSpot(int index, WinChartViewer viewer, WinHotSpotEventArgs e)
        {
            String nodeName;

            Hashtable table = e.AttrValues;
            String chartSubType = table["dataSetName"].ToString();
            if (chartSubType.Length == 0)
            {
                bool found = false;
                // clicking is inexact, try and see if we're nearby something that is clickable
                for (int i = 0; i < 5; i++)
                {
                    for (int j = 0; j < 5; j++)
                    {
                        // check ++, +-, -+, --
                        if (!found)
                        {
                            table = viewer.GetHotSpot(e.X + i, e.Y + j);
                            if (table != null)
                            {
                                chartSubType = table["dataSetName"].ToString();
                                if (chartSubType.Length > 0)
                                {
                                    found = true;
                                }
                            }
                        }
                        if (!found)
                        {
                            table = viewer.GetHotSpot(e.X + i, e.Y - j);
                            if (table != null)
                            {
                                chartSubType = table["dataSetName"].ToString();
                                if (chartSubType.Length > 0)
                                {
                                    found = true;
                                }
                            }
                        }
                        if (!found)
                        {
                            table = viewer.GetHotSpot(e.X - i, e.Y + j);
                            if (table != null)
                            {
                                chartSubType = table["dataSetName"].ToString();
                                if (chartSubType.Length > 0)
                                {
                                    found = true;
                                }
                            }
                        }
                    }
                }
                if (!found) //if there is no dataSetName -- there is nothing to show on the popup
                {
                    return;
                }
            }

            String xLabel = table["x"].ToString();

            switch (index)
            {
                case 0:
                    nodeName = first.Text;
                    break;
                case 1:
                    nodeName = second.Text;
                    break;
                case 2:
                    nodeName = third.Text;
                    break;
                default: nodeName = "unknown"; break;
            }
            if (this.ChartOutputType.Equals(OutputType.INFO_ELEMENT))
            {
                if (pop2 != null && pop2.Visible.Equals(true))
                {
                    pop2.Visible = false;
                }
                pop2 = new Chart.InfoTablePopUp(xLabel, nodeName, chartData.GetDataForDetailPopup(this.ChartOutputType, chartSubType, nodeName + "-" + xLabel));
                pop2.Visible = true;
            }
            else
            {
                if (pop != null && pop.Visible.Equals(true))
                {
                    pop.Visible = false;
                }
                pop = new Chart.TablePopUp(xLabel, nodeName, chartData.GetDataForDetailPopup(this.ChartOutputType, chartSubType, nodeName + "-" + xLabel));
                pop.Visible = true;
            }
            //Console.WriteLine("X: " + e.AttrValues["x"] + " Value: " + e.AttrValues["value"] + " Node: " + nodeName);
        }
Esempio n. 36
0
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.statusBarPanel = new System.Windows.Forms.StatusBarPanel();
            this.BackPB = new System.Windows.Forms.ToolBarButton();
            this.ForwardPB = new System.Windows.Forms.ToolBarButton();
            this.PreviousPB = new System.Windows.Forms.ToolBarButton();
            this.NextPB = new System.Windows.Forms.ToolBarButton();
            this.ViewSourcePB = new System.Windows.Forms.ToolBarButton();
            this.HelpPB = new System.Windows.Forms.ToolBarButton();
            this.treeView = new AME.Views.View_Components.ToolTipTreeView();
            this.panel1 = new System.Windows.Forms.Panel();
            this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
            this.winChartViewer3 = new ChartDirector.WinChartViewer();
            this.winChartViewer2 = new ChartDirector.WinChartViewer();
            this.winChartViewer1 = new ChartDirector.WinChartViewer();
            this.hScrollBar1 = new System.Windows.Forms.HScrollBar();
            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel)).BeginInit();
            this.panel1.SuspendLayout();
            this.tableLayoutPanel1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.winChartViewer3)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.winChartViewer2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.winChartViewer1)).BeginInit();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.SuspendLayout();
            // 
            // statusBarPanel
            // 
            this.statusBarPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
            this.statusBarPanel.Name = "statusBarPanel";
            this.statusBarPanel.Text = " Please select chart to view";
            this.statusBarPanel.Width = 816;
            // 
            // BackPB
            // 
            this.BackPB.Enabled = false;
            this.BackPB.ImageIndex = 0;
            this.BackPB.Name = "BackPB";
            this.BackPB.Text = "Back";
            // 
            // ForwardPB
            // 
            this.ForwardPB.Enabled = false;
            this.ForwardPB.ImageIndex = 1;
            this.ForwardPB.Name = "ForwardPB";
            this.ForwardPB.Text = "Forward";
            // 
            // PreviousPB
            // 
            this.PreviousPB.ImageIndex = 2;
            this.PreviousPB.Name = "PreviousPB";
            this.PreviousPB.Text = "Previous";
            // 
            // NextPB
            // 
            this.NextPB.ImageIndex = 3;
            this.NextPB.Name = "NextPB";
            this.NextPB.Text = "Next";
            // 
            // ViewSourcePB
            // 
            this.ViewSourcePB.ImageIndex = 4;
            this.ViewSourcePB.Name = "ViewSourcePB";
            this.ViewSourcePB.Text = "View Code";
            // 
            // HelpPB
            // 
            this.HelpPB.ImageIndex = 5;
            this.HelpPB.Name = "HelpPB";
            this.HelpPB.Text = "View Doc";
            // 
            // treeView
            // 
            this.treeView.Dock = System.Windows.Forms.DockStyle.Fill;
            this.treeView.HotTracking = true;
            this.treeView.ItemHeight = 16;
            this.treeView.Location = new System.Drawing.Point(0, 0);
            this.treeView.Name = "treeView";
            this.treeView.Size = new System.Drawing.Size(197, 504);
            this.treeView.TabIndex = 5;
            this.treeView.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView_BeforeExpand);
            this.treeView.BeforeCollapse += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView_BeforeCollapse);
            this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect);
            // 
            // panel1
            // 
            this.panel1.BackColor = System.Drawing.SystemColors.ControlLightLight;
            this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.panel1.Controls.Add(this.tableLayoutPanel1);
            this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panel1.Location = new System.Drawing.Point(0, 0);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(631, 504);
            this.panel1.TabIndex = 6;
            // 
            // tableLayoutPanel1
            // 
            this.tableLayoutPanel1.ColumnCount = 1;
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tableLayoutPanel1.Controls.Add(this.winChartViewer3, 0, 2);
            this.tableLayoutPanel1.Controls.Add(this.winChartViewer2, 0, 1);
            this.tableLayoutPanel1.Controls.Add(this.winChartViewer1, 0, 0);
            this.tableLayoutPanel1.Controls.Add(this.hScrollBar1, 0, 3);
            this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
            this.tableLayoutPanel1.Name = "tableLayoutPanel1";
            this.tableLayoutPanel1.RowCount = 4;
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 16F));
            this.tableLayoutPanel1.Size = new System.Drawing.Size(627, 500);
            this.tableLayoutPanel1.TabIndex = 7;
            // 
            // winChartViewer3
            // 
            this.winChartViewer3.Location = new System.Drawing.Point(4, 326);
            this.winChartViewer3.Dock = DockStyle.Fill;
            this.winChartViewer3.Margin = new System.Windows.Forms.Padding(4);
            this.winChartViewer3.Name = "winChartViewer3";
            this.winChartViewer3.ScrollDirection = ChartDirector.WinChartDirection.HorizontalVertical;
            this.winChartViewer3.Size = new System.Drawing.Size(618, 153);
            this.winChartViewer3.TabIndex = 8;
            this.winChartViewer3.TabStop = false;
            this.winChartViewer3.ViewPortChanged += new ChartDirector.WinViewPortEventHandler(this.winChartViewer3_ViewPortChanged);
            this.winChartViewer3.Resize += new System.EventHandler(this.winChartViewer3_Resize);
            // 
            // winChartViewer2
            // 
            this.winChartViewer2.Location = new System.Drawing.Point(4, 165);
            this.winChartViewer2.Dock = DockStyle.Fill;
            this.winChartViewer2.Margin = new System.Windows.Forms.Padding(4);
            this.winChartViewer2.Name = "winChartViewer2";
            this.winChartViewer2.ScrollDirection = ChartDirector.WinChartDirection.HorizontalVertical;
            this.winChartViewer2.Size = new System.Drawing.Size(618, 151);
            this.winChartViewer2.TabIndex = 7;
            this.winChartViewer2.TabStop = false;
            this.winChartViewer2.ViewPortChanged += new ChartDirector.WinViewPortEventHandler(this.winChartViewer2_ViewPortChanged);
            this.winChartViewer2.Resize += new System.EventHandler(this.winChartViewer2_Resize);
            // 
            // winChartViewer1
            // 
            this.winChartViewer1.Location = new System.Drawing.Point(4, 4);
            this.winChartViewer1.Dock = DockStyle.Fill;
            this.winChartViewer1.Margin = new System.Windows.Forms.Padding(4);
            this.winChartViewer1.Name = "winChartViewer1";
            this.winChartViewer1.ScrollDirection = ChartDirector.WinChartDirection.HorizontalVertical;
            this.winChartViewer1.Size = new System.Drawing.Size(618, 152);
            this.winChartViewer1.TabIndex = 6;
            this.winChartViewer1.TabStop = false;
            this.winChartViewer1.ViewPortChanged += new ChartDirector.WinViewPortEventHandler(this.winChartViewer1_ViewPortChanged_1);
            this.winChartViewer1.Resize += new System.EventHandler(this.winChartViewer1_Resize);
            // 
            // hScrollBar1
            // 
            this.hScrollBar1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.hScrollBar1.Location = new System.Drawing.Point(0, 483);
            this.hScrollBar1.Name = "hScrollBar1";
            this.hScrollBar1.Size = new System.Drawing.Size(627, 17);
            this.hScrollBar1.TabIndex = 9;
            this.hScrollBar1.ValueChanged += new System.EventHandler(this.hScrollBar1_ValueChanged);
            // 
            // splitContainer1
            // 
            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainer1.Location = new System.Drawing.Point(0, 0);
            this.splitContainer1.Name = "splitContainer1";
            // 
            // splitContainer1.Panel1
            // 
            this.splitContainer1.Panel1.Controls.Add(this.treeView);
            // 
            // splitContainer1.Panel2
            // 
            this.splitContainer1.Panel2.Controls.Add(this.panel1);
            this.splitContainer1.Size = new System.Drawing.Size(832, 504);
            this.splitContainer1.SplitterDistance = 197;
            this.splitContainer1.TabIndex = 8;
            // 
            // ChartExplorer
            // 
            this.Controls.Add(this.splitContainer1);
            this.Name = "ChartExplorer";
            this.Size = new System.Drawing.Size(832, 504);
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel)).EndInit();
            this.panel1.ResumeLayout(false);
            this.tableLayoutPanel1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.winChartViewer3)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.winChartViewer2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.winChartViewer1)).EndInit();
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel2.ResumeLayout(false);
            this.splitContainer1.ResumeLayout(false);
            this.ResumeLayout(false);

		}
Esempio n. 37
0
        private void drawChart(WinChartViewer viewer)
        {
            DateTime viewPortStartDate = beginDate.AddSeconds(Math.Round(viewer.ViewPortLeft * dateRange));
            DateTime viewPortEndDate = viewPortStartDate.AddSeconds(Math.Round(viewer.ViewPortWidth * dateRange));
            TimeSpan hoursCalc = viewPortEndDate.Subtract(viewPortStartDate);
            int hours = (hoursCalc.Days * 24) + hoursCalc.Hours;
            viewPortEndDate = viewPortEndDate.AddMinutes(12 * hours); // hack to show hour labels
            Double axisLowerLimit = 0 + viewer.ViewPortTop * rowRange;
            Double axisUpperLimit = axisLowerLimit + viewer.ViewPortHeight * (rowRange);

            XYChart c = new XYChart(winChartViewer1.Width, this.winChartViewer1.Height, 0xf0f0ff, 0, 1);
            //c.setRoundedFrame(ChartDirector.Chart.CColor(BackColor));
			
			// Set the plotarea at (52, 60) and of size 520 x 192 pixels. Use white (ffffff) 
			// background. Enable both horizontal and vertical grids by setting their colors to 
			// grey (cccccc). Set clipping mode to clip the data lines to the plot area.
            int tryToBeMoreDynamic = this.Parent.Height - 200; // instead of hardcoding height
            c.setPlotArea(100, 50, 600, tryToBeMoreDynamic, 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
			c.setClipping();

            c.yAxis().setWidth(2);
            c.yAxis().setDateScale(viewPortStartDate, viewPortEndDate);
            c.yAxis().setMultiFormat(ChartDirector.Chart.StartOfHourFilter(), "<*font=bold*>{value|w hh:nn}", ChartDirector.Chart.AllPassFilter(), "{value|w hh:nn}");

            c.xAxis().setWidth(2);
            c.xAxis().setLinearScale(axisLowerLimit, axisUpperLimit, 1);
            c.xAxis().setRounding(false, false);
            c.xAxis().setColors(0xcccccc, ChartDirector.Chart.Transparent);
            c.xAxis().setReverse();

            // swap the x and y axes to create a horziontal box-whisker chart
            c.swapXY();
            BoxWhiskerLayer layer = c.addBoxWhiskerLayer2(ChartDirector.Chart.CTime(timelineBlockBegins.ToArray()), ChartDirector.Chart.CTime(timelineBlockEnds.ToArray()));
            layer.setBoxColors(timelineBlockColors.ToArray());
            layer.addExtraField(timelineBlockNames.ToArray());
            layer.setXData(timelineBlockRow.ToArray());
            layer.setDataLabelFormat("{field0}");
            layer.setDataLabelStyle("Arial Bold").setAlignment(ChartDirector.Chart.Center);
            layer.setDataWidth(35);
            //layer.setDataGap(1);
            // TimelineRow parent
            Double rowParent = 0;
            Int32 colorParentIndex = 0;
            c.xAxis().addMark(0, 0x000000).setLineWidth(2);
            foreach (Double d in timelineBlockZones)
            {
                Double rowParentBegin = rowParent; // --0.5;
                Double rowParentEnd = d + 0.5; // --0.5;

                c.xAxis().addZone(rowParentBegin, rowParentEnd, timelineRowColors[colorParentIndex]);

                Mark xMark1 = c.xAxis().addMark(rowParentBegin, 0x000000, timelineRowNames[colorParentIndex]);
                xMark1.setLineWidth(2);
                xMark1.setFontStyle("Arial Bold Italic");

                // xMark1.setAlignment(ChartDirector.Chart.Center);

                //Mark xMark2 = c.xAxis().addMark(rowParentBegin, 0x000000);
                //xMark2.setLineWidth(2);

                rowParent = d;

                colorParentIndex++;
            }

            // TimelineRow child;
            double inset = 0.5;
            Int32 colorChildIndex = 0;
            foreach (String s in timelineRows)
            {
                Mark xMark = c.xAxis().addMark(colorChildIndex + inset, 0x000000, s);
                xMark.setLineWidth(0);

                colorChildIndex++;
            }

            // Milestones
            c.yAxis2().setDateScale(viewPortStartDate, viewPortEndDate);
            c.yAxis2().setColors(ChartDirector.Chart.Transparent, ChartDirector.Chart.Transparent, ChartDirector.Chart.Transparent);

            if (bShowMilestones)
            {
                Int32 timelineMilestoneCount = 0;
                int indentY = 40;
                double previousValue = 0.0;

                List<IndexedTime> indexedTimes = new List<IndexedTime>();
                for (int i = 0; i < timelineMilestoneTimes.Count; i++)
                {
                    indexedTimes.Add(new IndexedTime(timelineMilestoneTimes[i], i));
                }
                indexedTimes.Sort();

                int one = Int32.Parse("000000", System.Globalization.NumberStyles.AllowHexSpecifier);
                int two = Int32.Parse("888888", System.Globalization.NumberStyles.AllowHexSpecifier);
                int three = Int32.Parse("BB7700", System.Globalization.NumberStyles.AllowHexSpecifier);
                Int32 lineColor = one;

                foreach (IndexedTime time in indexedTimes)
                {
                    if (indentY > tryToBeMoreDynamic-10)
                    {
                        indentY = 40;
                    }

                    indentY += 20;

                    //Int32 lineColor = timelineMilestoneColors[time.Index];
                    Double value = ChartDirector.Chart.CTime(time.Time);

                    if (!value.Equals(previousValue))
                    {
                        if (lineColor == one)
                        {
                            lineColor = two;
                        }
                        else if (lineColor == two)
                        {
                            lineColor = three;
                        }
                        else if (lineColor == three)
                        {
                            lineColor = one;
                        }
                    }

                    Mark yMark = c.yAxis2().addMark(value, c.dashLineColor(lineColor, ChartDirector.Chart.DashLine), timelineMilestoneNames[time.Index]);

                    yMark.setPos(0, indentY);
                    yMark.setFontColor(lineColor);
                    yMark.setLineWidth(2);
                    yMark.setFontStyle("Arial Bold");
                    timelineMilestoneCount++;
                    previousValue = value;
                }
            }

            if (legendStrings != null)
            {
                LegendBox l = c.addLegend(5, 5);
                l.setFontSize(legendFontSize);
                l.setCols(legendStrings.Length);

                for (int i = 0; i < legendStrings.Length; i++)
                {
                    l.addKey(legendStrings[i], legendColors[i]);
                }
            }

            if (navigator != null && componentId >= 0 && legend.Items.Count == 0)
            {
                XPathNodeIterator iTLFilter = navigator.Select("//TimelineFilter");
                List<Int32> seenIDs = new List<Int32>();

                ImageList forLegend = new ImageList();
                foreach (XPathNavigator tlFilterItem in iTLFilter)
                {
                    string filterItemColor = tlFilterItem.GetAttribute(colorAttribute, tlFilterItem.NamespaceURI);

                    if (!forLegend.Images.ContainsKey(filterItemColor))
                    {
                        try
                        {
                            Bitmap bm = new Bitmap(16, 16);
                            Graphics g = Graphics.FromImage((Image)bm);
                            Brush forGraphics = new SolidBrush(HexToColor(filterItemColor));
                            
                            g.SmoothingMode = SmoothingMode.AntiAlias;
                            g.FillRectangle(forGraphics, new Rectangle(0, 0, bm.Width, bm.Height));
                            Icon icon = Icon.FromHandle(bm.GetHicon());
                            forGraphics.Dispose();
                            g.Dispose();
                            bm.Dispose();

                            forLegend.Images.Add(filterItemColor, icon);
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(e.Message, "Error creating icon");
                        }
                    }
                }

                legend.SmallImageList = forLegend;

                foreach (XPathNavigator tlFilterItem in iTLFilter)
                {
                    string filterItemName = tlFilterItem.GetAttribute(nameAttribute, tlFilterItem.NamespaceURI);
                    string filterItemID = tlFilterItem.GetAttribute(idAttribute, tlFilterItem.NamespaceURI);
                    string filterItemType = tlFilterItem.GetAttribute(typeAttribute, tlFilterItem.NamespaceURI);
                    string filterItemColor = tlFilterItem.GetAttribute(colorAttribute, tlFilterItem.NamespaceURI);

                    int iParse = Int32.Parse(filterItemID);
                    if (!seenIDs.Contains(iParse))
                    {
                        legend.Items.Add(filterItemName, filterItemColor);
                        seenIDs.Add(iParse);
                    }
                }
            }

            //Int32 timelineMilestoneCount = 0;
            //foreach (String milestonName in timelineMilestoneNames)
            //{
            //    Double[] xData = { 0 };
            //    Double[] yData = { ChartDirector.Chart.CTime(timelineMilestoneTimes[timelineMilestoneCount]) };
            //    Int32 color = timelineMilestoneColors[timelineMilestoneCount];
            //    ScatterLayer sLayer = c.addScatterLayer(xData, yData, "", ChartDirector.Chart.TriangleSymbol, 13, color);
            //    timelineMilestoneCount++;

            //    // Add labels to the chart as an extra field
            //    sLayer.addExtraField(timelineMilestoneNames.ToArray());

            //    // Set the data label format to display the extra field
            //    sLayer.setDataLabelFormat("{field0}");
            //}

			viewer.Chart = c;
        }
Esempio n. 38
0
 private void updateImageMap(WinChartViewer viewer)
 {
     // Include tool tip for the chart
     if (winChartViewer1.ImageMap == null)
     {
         //winChartViewer1.ImageMap = winChartViewer1.Chart.getHTMLImageMap("clickable", "",
         //"title='[{dataSetName}] {x|mmm dd, yyyy}: USD {value|2}'");
     }
 }