示例#1
0
        //Main code for creating charts
        public void createChart(WinChartViewer viewer, string img)
        {
            // The data for the chart
            double[] data   = { 5.5, 3.5, -3.7, 1.7, -1.4, 3.3 };
            string[] labels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun" };

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

            // Set the plot area at (30, 20) and of size 140 x 140 pixels
            c.setPlotArea(30, 20, 140, 140);

            // Configure the axis as according to the input parameter
            if (img == "0")
            {
                c.addTitle("No Axis Extension", "Arial", 8);
            }
            else if (img == "1")
            {
                c.addTitle("Top/Bottom Extensions = 0/0", "Arial", 8);
                // Reserve 20% margin at top of plot area when auto-scaling
                c.yAxis().setAutoScale(0, 0);
            }
            else if (img == "2")
            {
                c.addTitle("Top/Bottom Extensions = 0.2/0.2", "Arial", 8);
                // Reserve 20% margin at top and bottom of plot area when
                // auto-scaling
                c.yAxis().setAutoScale(0.2, 0.2);
            }
            else if (img == "3")
            {
                c.addTitle("Axis Top Margin = 15", "Arial", 8);
                // Reserve 15 pixels at top of plot area
                c.yAxis().setMargin(15);
            }
            else
            {
                c.addTitle("Manual Scale -5 to 10", "Arial", 8);
                // Set the y axis to scale from -5 to 10, with ticks every 5 units
                c.yAxis().setLinearScale(-5, 10, 5);
            }

            // 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.Image = c.makeImage();

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='ROI for {xLabel}: {value}%'");
        }
示例#2
0
        private void preSetup()
        {
            _chart.setRoundedFrame();

            if (_title != null && _title.Length > 0)
            {
                TextBox titleTextBox;

                titleTextBox = _chart.addTitle(_title);
                if (_rcp.ChartSize == RankChartParameters.ChartSizes.Small)
                {
                    titleTextBox.setFontSize(10.0);
                }
                titleTextBox.setBackground(0xdddddd, 0, Chart.glassEffect());

                _headerHeight = titleTextBox.getHeight();
            }

            //Add the ranktrend website
            if (_rcp.ChartSize == RankChartParameters.ChartSizes.Small)
            {
                _chart.addText(ChartWidth - RIGHT_MARGIN - 143, _headerHeight + 3, "http://www.RankTrend.com", "Arial", 8,
                               Chart.CColor(Color.DarkGray));
            }
            else
            {
                _chart.addText(ChartWidth - RIGHT_MARGIN - 173, _headerHeight + 3, "http://www.RankTrend.com", "Arial Bold", 10,
                               Chart.CColor(Color.DarkGray));
            }

            //This needs to be done at the right time or it won't show up
            drawLegend();
        }
示例#3
0
        //
        // Create chart
        //
        private void createChart(RazorChartViewer viewer)
        {
            // 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", "Thur", "Fri" };

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

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

            // Set the plotarea at (50, 55) and of 440 x 280 pixels in size. Use a vertical gradient
            // color from light blue (f9f9ff) to blue (6666ff) as background. Set border and grid lines
            // to white (ffffff).
            c.setPlotArea(50, 55, 440, 280, c.linearGradientColor(0, 55, 0, 335, 0xf9f9ff, 0x6666ff), -1,
                          0xffffff, 0xffffff);

            // Add a legend box at (50, 28) using horizontal layout. Use 10pt Arial Bold as font, with
            // transparent background.
            c.addLegend(50, 28, false, "Arial Bold", 10).setBackground(Chart.Transparent);

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

            // Draw the ticks between label positions (instead of at label positions)
            c.xAxis().setTickOffset(0.5);

            // Set axis label style to 8pt Arial Bold
            c.xAxis().setLabelStyle("Arial Bold", 8);
            c.yAxis().setLabelStyle("Arial Bold", 8);

            // Set axis line width to 2 pixels
            c.xAxis().setWidth(2);
            c.yAxis().setWidth(2);

            // Add axis title
            c.yAxis().setTitle("Throughput (MBytes Per Hour)");

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

            layer.addDataSet(data0, 0xff0000, "Server #1");
            layer.addDataSet(data1, 0x00ff00, "Server #2");
            layer.addDataSet(data2, 0xff8800, "Server #3");

            // Set bar border to transparent. Use glass lighting effect with light direction from left.
            layer.setBorderColor(Chart.Transparent, Chart.glassEffect(Chart.NormalGlare, Chart.Left));

            // Configure the bars within a group to touch each others (no gap)
            layer.setBarGap(0.2, Chart.TouchBar);

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

            // Output Javascript chart model to the browser to suppport tracking cursor
            viewer.ChartModel = c.getJsChartModel();
        }
示例#4
0
        //Main code for creating chart.
        //Note: the argument img is unused because this demo only has 1 chart.
        public void createChart(WinChartViewer viewer, string img)
        {
            // The XY points for the scatter chart
            double[] dataX = { 150, 400, 300, 1500, 800 };
            double[] dataY = { 0.6, 8, 5.4, 2, 4 };

            // The labels for the points
            string[] labels = { "Nano\n100",       "SpeedTron\n200 Lite", "SpeedTron\n200",
                                "Marathon\nExtra", "Marathon\n2000" };

            // 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, 0xffffff, -1, 0xc0c0c0, 0xc0c0c0, -1);

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

            // Add a title to the y axis using 12 pts Arial Bold Italic font
            c.yAxis().setTitle("Capacity (tons)", "Arial Bold Italic", 12);

            // Add a title to the x axis using 12 pts Arial Bold Italic font
            c.xAxis().setTitle("Range (miles)", "Arial Bold Italic", 12);

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

            // Add the data as a scatter chart layer, using a 15 pixel circle as the
            // symbol
            ScatterLayer layer = c.addScatterLayer(dataX, dataY, "",
                                                   Chart.GlassSphereShape, 15, 0xff3333, 0xff3333);

            // Add labels to the chart as an extra field
            layer.addExtraField(labels);

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

            // Use 8pts Arial Bold to display the labels
            ChartDirector.TextBox textbox = layer.setDataLabelStyle("Arial Bold", 8);

            // Set the background to purple with a 1 pixel 3D border
            textbox.setBackground(0xcc99ff, Chart.Transparent, 1);

            // Put the text box 4 pixels to the right of the data point
            textbox.setAlignment(Chart.Left);
            textbox.setPos(4, 0);

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='Range = {x} miles, Capacity = {value} tons'");
        }
示例#5
0
        //
        // Create chart
        //
        private void createChart(RazorChartViewer viewer)
        {
            // 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 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
            c.addTitle("Weekly Server Load");

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

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

            // Add a bar chart layer with green (0x00ff00) bars using the given data
            c.addBarLayer(data, 0x00ff00).set3D();

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

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

            // Include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("", "", "title='{xLabel}: {value} MBytes'");
        }
示例#6
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[] data = { 3.9, 8.1, 10.9, 14.2, 18.1, 19.0, 21.2, 23.2, 25.7, 36 };

            // The labels for the bar chart
            string[] labels = { "Bastic Group", "Simpa",        "YG Super", "CID",
                                "Giga Tech",    "Indo Digital", "Supreme",  "Electech","THP Thunder",
                                "Flash Light" };

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

            // Add a title to the chart using Arial Bold Italic font
            c.addTitle("Revenue Estimation - Year 2002", "Arial Bold Italic");

            // Set the plotarea at (100, 30) and of size 400 x 200 pixels. Set the
            // plotarea border, background and grid lines to Transparent
            c.setPlotArea(100, 30, 400, 200, Chart.Transparent, Chart.Transparent,
                          Chart.Transparent, Chart.Transparent, Chart.Transparent);

            // Add a bar chart layer using the given data. Use a gradient color for
            // the bars, where the gradient is from dark green (0x008000) to white
            // (0xffffff)
            BarLayer layer = c.addBarLayer(data, c.gradientColor(100, 0, 500, 0,
                                                                 0x008000, 0xffffff));

            // Swap the axis so that the bars are drawn horizontally
            c.swapXY(true);

            // Set the bar gap to 10%
            layer.setBarGap(0.1);

            // Use the format "US$ xxx millions" as the bar label
            layer.setAggregateLabelFormat("US$ {value} millions");

            // Set the bar label font to 10 pts Times Bold Italic/dark red (0x663300)
            layer.setAggregateLabelStyle("Times New Roman Bold Italic", 10, 0x663300)
            ;

            // Set the labels on the x axis
            ChartDirector.TextBox textbox = c.xAxis().setLabels(labels);

            // Set the x axis label font to 10pt Arial Bold Italic
            textbox.setFontStyle("Arial Bold Italic");
            textbox.setFontSize(10);

            // Set the x axis to Transparent, with labels in dark red (0x663300)
            c.xAxis().setColors(Chart.Transparent, 0x663300);

            // Set the y axis and labels to Transparent
            c.yAxis().setColors(Chart.Transparent, Chart.Transparent);

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{xLabel}: US${value} millions'");
        }
示例#7
0
        public void createChart()
        {
            string[] xLabels = null;
            if (data.Count != 0)
            {
                xLabels = new string[data.Count];

                for (int i = 0; i < xLabels.Length; i++)
                {
                    xLabels[i] = (i + 1).ToString();
                }
            }

            XYChart c = new XYChart(795, 455);

            c.setBackground(c.linearGradientColor(0, 0, 0, 100, 0x99ccff, 0xffffff), 0x888888);

            //LegendBox legendBox = c.addLegend(450, 80, false, "Arial", 8);
            //legendBox.setAlignment(Chart.BottomCenter);
            //legendBox.setBackground(Chart.Transparent, Chart.Transparent);
            //legendBox.setLineStyleKey();
            //legendBox.setFontSize(8);

            ChartDirector.TextBox title = c.addTitle("傅里叶数据分析", "Arial Bold", 13);
            title.setPos(0, 20);

            c.setPlotArea(50, 60, 730, 345, 0xffffff, -1, -1, c.dashLineColor(
                              0xaaaaaa, Chart.DotLine), -1);

            c.xAxis().setLabels(xLabels);
            c.xAxis().setLabelStep(9);
            c.xAxis().setIndent(true);
            c.xAxis().setTitle("数据序号");
            c.yAxis().setTitle("数据值").setAlignment(Chart.TopLeft2);

            LineLayer layer;
            int       hzColor = Chart.CColor(Color.DeepPink);

            layer = c.addLineLayer2();
            layer.addDataSet(data.ToArray(), hzColor, "数据值");            //.setDataSymbol(Chart.CircleSymbol, 3); ;
            layer.setLineWidth(2);
            layer.setFastLineMode();

            if (minX == maxX)
            {
                c.layout();
                minX = c.xAxis().getMinValue();
                minY = c.yAxis().getMinValue();
                maxX = c.xAxis().getMaxValue();
                maxY = c.yAxis().getMaxValue();
            }

            //SetXYChartScale(minX, minY, maxX, maxY, winChartViewer1, c);
            //winChartViewer1.syncLinearAxisWithViewPort("x", c.xAxis());
            //winChartViewer1.syncLinearAxisWithViewPort("y", c.yAxis());

            winChartViewer1.Chart    = c;
            winChartViewer1.ImageMap =
                winChartViewer1.Chart.getHTMLImageMap("clickable", "", "title='数据序号: {xLabel}, {dataSetName}: {value}'");
        }
示例#8
0
        //
        // Create chart
        //
        private void createChart(RazorChartViewer viewer)
        {
            // Data for the chart as 2 random data series
            RanSeries r = new RanSeries(127);

            double[]   data0      = r.getSeries(180, 10, -1.5, 1.5);
            double[]   data1      = r.getSeries(180, 150, -15, 15);
            DateTime[] timeStamps = r.getDateSeries(180, new DateTime(2011, 1, 1), 86400);

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

            // Add a title to the chart using 18pt Times New Roman Bold Italic font
            c.addTitle("Plasma Stabilizer Energy Usage", "Times New Roman Bold Italic", 18);

            // Set the plotarea at (50, 55) with width 100 pixels less than chart width, and height 90
            // pixels less than chart height. Use a vertical gradient from light blue (f0f6ff) to sky
            // blue (a0c0ff) as background. Set border to transparent and grid lines to white (ffffff).
            c.setPlotArea(50, 55, c.getWidth() - 100, c.getHeight() - 90, c.linearGradientColor(0, 55, 0,
                                                                                                c.getHeight() - 35, 0xf0f6ff, 0xa0c0ff), -1, Chart.Transparent, 0xffffff, 0xffffff);

            // Add a legend box at (50, 25) using horizontal layout. Use 10pt Arial Bold as font. Set the
            // background and border color to Transparent.
            c.addLegend(50, 25, false, "Arial Bold", 10).setBackground(Chart.Transparent);

            // Set axis label style to 8pt Arial Bold
            c.xAxis().setLabelStyle("Arial Bold", 8);
            c.yAxis().setLabelStyle("Arial Bold", 8);
            c.yAxis2().setLabelStyle("Arial Bold", 8);

            // Set the axis stem to transparent
            c.xAxis().setColors(Chart.Transparent);
            c.yAxis().setColors(Chart.Transparent);
            c.yAxis2().setColors(Chart.Transparent);

            // Configure x-axis label format
            c.xAxis().setMultiFormat(Chart.StartOfYearFilter(), "{value|mm/yyyy} ",
                                     Chart.StartOfMonthFilter(), "{value|mm}");

            // Add axis title using 10pt Arial Bold Italic font
            c.yAxis().setTitle("Power Usage (Watt)", "Arial Bold Italic", 10);
            c.yAxis2().setTitle("Effective Load (kg)", "Arial Bold Italic", 10);

            // Add a line layer to the chart using a line width of 2 pixels.
            LineLayer layer = c.addLineLayer2();

            layer.setLineWidth(2);

            // Add 2 data series to the line layer
            layer.setXData(timeStamps);
            layer.addDataSet(data0, 0xcc0000, "Power Usage");
            layer.addDataSet(data1, 0x008800, "Effective Load").setUseYAxis2();

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

            // Output Javascript chart model to the browser to suppport tracking cursor
            viewer.ChartModel = c.getJsChartModel();
        }
        //
        // Create chart
        //
        private void createChart(RazorChartViewer viewer)
        {
            // 4 data points to represent the cash flow for the Q1 - Q4
            double[] data = { 230, 140, 220, 330, 150 };

            // We want to plot a waterfall chart showing the 4 quarters as well as the total
            string[] labels = { "Product 1", "Product 2", "Product 3", "Product 4", "Product 5", "Total" };

            // The top side of the bars in a waterfall chart is the accumulated data. We use the
            // ChartDirector ArrayMath utility to accumulate the data. The "total" is handled by
            // inserting a zero point at the end before accumulation (after accumulation it will become
            // the total).
            double[] boxTop = new ArrayMath(data).insert2(0, 1).acc().result();

            // The botom side of the bars is just the top side of the previous bar. So we shifted the top
            // side data to obtain the bottom side data.
            double[] boxBottom = new ArrayMath(boxTop).shift(1, 0).result();

            // The last point (total) is different. Its bottom side is always 0.
            boxBottom[boxBottom.Length - 1] = 0;

            // Create a XYChart object of size 500 x 280 pixels. Set background color to light blue
            // (ccccff), with 1 pixel 3D border effect.
            XYChart c = new XYChart(500, 290, 0xccccff, 0x000000, 1);

            // Add a title to the chart using 13 points Arial Bold Itatic font, with white (ffffff) text
            // on a deep blue (0x80) background
            c.addTitle("Product Revenue - Year 2004", "Arial Bold Italic", 13, 0xffffff).setBackground(
                0x000080);

            // Set the plotarea at (55, 50) and of size 430 x 215 pixels. Use alternative white/grey
            // background.
            c.setPlotArea(55, 45, 430, 215, 0xffffff, 0xeeeeee);

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

            // Set the x-axis ticks and grid lines to be between the bars
            c.xAxis().setTickOffset(0.5);

            // Use Arial Bold as the y axis label font
            c.yAxis().setLabelStyle("Arial Bold");

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

            // Add a multi-color box-whisker layer to represent the waterfall bars
            BoxWhiskerLayer layer = c.addBoxWhiskerLayer2(boxTop, boxBottom);

            // Put data labels on the bars to show the cash flow using Arial Bold font
            layer.setDataLabelFormat("{={top}-{bottom}}M");
            layer.setDataLabelStyle("Arial Bold").setAlignment(Chart.Center);

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

            // Include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("", "", "title='{xLabel}: {={top}-{bottom}} millions'");
        }
示例#10
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 area chart
            double[] data = { 3.0, 2.8, 4.0, 5.5, 7.5, 6.8, 5.4, 6.0, 5.0, 6.2, 7.5,
                              6.5, 7.5, 8.1, 6.0, 5.5, 5.3, 3.5, 5.0, 6.6, 5.6, 4.8, 5.2, 6.5, 6.2 }

            ;

            // The labels for the area 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 180 pixels. Set the background
            // to pale yellow (0xffffa0) with a black border (0x0)
            XYChart c = new XYChart(300, 180, 0xffffa0, 0x000000);

            // Set the plotarea at (45, 35) and of size 240 x 120 pixels. Set the
            // background to white (0xffffff). Set both horizontal and vertical grid
            // lines to black (&H0&) dotted lines (pattern code 0x0103)
            c.setPlotArea(45, 35, 240, 120, 0xffffff, -1, -1, c.dashLineColor(
                              0x000000, 0x000103), c.dashLineColor(0x000000, 0x000103));

            // Add a title to the chart using 10 pts Arial Bold font. Use a 1 x 2
            // bitmap pattern as the background. Set the border to black (0x0).
            c.addTitle("Snow Percipitation (Dec 12)", "Arial Bold", 10
                       ).setBackground(c.patternColor(new int[] { 0xb0b0f0, 0xe0e0ff }, 2),
                                       0x000000);

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

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

            // Display 1 out of 3 labels on the x-axis.
            c.xAxis().setLabelStep(3);

            // Add an area layer to the chart
            AreaLayer layer = c.addAreaLayer();

            // Load a snow pattern from an external file "snow.png".
            int snowPattern = c.patternColor2("snow.png");

            // Add a data set to the area layer using the snow pattern as the fill
            // color. Use deep blue (0x0000ff) as the area border line color
            // (&H0000ff&)
            layer.addDataSet(data).setDataColor(snowPattern, 0x0000ff);

            // Set the line width to 2 pixels to highlight the line
            layer.setLineWidth(2);

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{xLabel}:00 - {value} mm/hour'");
        }
示例#11
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[] data = { 450, 560, 630, 800, 1100, 1350, 1600, 1950, 2300, 2700 };

            // The labels for the bar chart
            string[] labels = { "1996", "1997", "1998", "1999", "2000", "2001",
                                "2002", "2003", "2004", "2005" };

            // Create a XYChart object of size 600 x 380 pixels. Set background color
            // to brushed silver, with a 2 pixel 3D border. Use rounded corners of 20
            // pixels radius.
            XYChart c = new XYChart(600, 380, Chart.brushedSilverColor(),
                                    Chart.Transparent, 2);

            // Add a title to the chart using 18pts Times Bold Italic font. Set
            // top/bottom margins to 8 pixels.
            c.addTitle("Annual Revenue for Star Tech", "Times New Roman Bold Italic",
                       18).setMargin2(0, 0, 8, 8);

            // Set the plotarea at (70, 55) and of size 460 x 280 pixels. Use
            // transparent border and black grid lines. Use rounded frame with radius
            // of 20 pixels.
            c.setPlotArea(70, 55, 460, 280, -1, -1, Chart.Transparent, 0x000000);
            c.setRoundedFrame(0xffffff, 20);

            // Add a multi-color bar chart layer using the supplied data. Set
            // cylinder bar shape.
            c.addBarLayer3(data).setBarShape(Chart.CircleShape);

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

            // Show the same scale on the left and right y-axes
            c.syncYAxis();

            // Set the left y-axis and right y-axis title using 10pt Arial Bold font
            c.yAxis().setTitle("USD (millions)", "Arial Bold", 10);
            c.yAxis2().setTitle("USD (millions)", "Arial Bold", 10);

            // Set y-axes to transparent
            c.yAxis().setColors(Chart.Transparent);
            c.yAxis2().setColors(Chart.Transparent);

            // Disable ticks on the x-axis by setting the tick color to transparent
            c.xAxis().setTickColor(Chart.Transparent);

            // Set the label styles of all axes to 8pt Arial Bold font
            c.xAxis().setLabelStyle("Arial Bold", 8);
            c.yAxis().setLabelStyle("Arial Bold", 8);
            c.yAxis2().setLabelStyle("Arial Bold", 8);

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='Year {xLabel}: US$ {value}M'");
        }
示例#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 data for the chart
            double[] data0  = { 0.05, 0.06, 0.48, 0.1, 0.01, 0.05 };
            double[] data1  = { 100, 125, 265, 147, 67, 105 };
            string[] labels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun" };

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

            // Set the plot area at (50, 20) and of size 200 x 130 pixels
            c.setPlotArea(50, 20, 200, 130);

            // Add a title to the chart using 8 pts Arial Bold font
            c.addTitle("Independent Y-Axis Demo", "Arial Bold", 8);

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

            // Add a title to the primary (left) y axis
            c.yAxis().setTitle("Packet Drop Rate (pps)");

            // Set the axis, label and title colors for the primary y axis to red
            // (0xc00000) to match the first data set
            c.yAxis().setColors(0xc00000, 0xc00000, 0xc00000);

            // Add a title to the secondary (right) y axis
            c.yAxis2().setTitle("Throughtput (MBytes)");

            // set the axis, label and title colors for the primary y axis to green
            // (0x008000) to match the second data set
            c.yAxis2().setColors(0x008000, 0x008000, 0x008000);

            // Add a line layer to for the first data set using red (0xc00000) color
            // with a line width to 3 pixels
            LineLayer lineLayer = c.addLineLayer(data0, 0xc00000);

            lineLayer.setLineWidth(3);

            // tool tip for the line layer
            lineLayer.setHTMLImageMap("", "",
                                      "title='Packet Drop Rate on {xLabel}: {value} pps'");

            // Add a bar layer to for the second data set using green (0x00C000)
            // color. Bind the second data set to the secondary (right) y axis
            BarLayer barLayer = c.addBarLayer(data1, 0x00c000);

            barLayer.setUseYAxis2();

            // tool tip for the bar layer
            barLayer.setHTMLImageMap("", "",
                                     "title='Throughput on {xLabel}: {value} MBytes'");

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

            // include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable");
        }
示例#13
0
        //
        // Create chart
        //
        private void createChart(RazorChartViewer viewer)
        {
            // The data for the chart
            double[] data0 = { 600, 800, 1200, 1500, 1800, 1900, 2000, 1950 };
            double[] data1 = { 300, 450, 500, 1000, 1500, 1600, 1650, 1600 };

            // The labels for the chart
            string[] labels = { "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002" };

            // Create a XYChart object of size 450 x 250 pixels, with a pale yellow (0xffffc0)
            // background, a black border, and 1 pixel 3D border effect.
            XYChart c = new XYChart(450, 250, 0xffffc0, 0, 1);

            // Set the plotarea at (60, 45) and of size 360 x 170 pixels, using white (0xffffff) as the
            // plot area background color. Turn on both horizontal and vertical grid lines with light
            // grey color (0xc0c0c0)
            c.setPlotArea(60, 45, 360, 170, 0xffffff, -1, -1, 0xc0c0c0, -1);

            // Add a legend box at (60, 20) (top of the chart) with horizontal layout. Use 8pt Arial Bold
            // font. Set the background and border color to Transparent.
            c.addLegend(60, 20, false, "Arial Bold", 8).setBackground(Chart.Transparent);

            // Add a title to the chart using 12pt Arial Bold/white font. Use a 1 x 2 bitmap pattern as
            // the background.
            c.addTitle("Information Resource Usage", "Arial Bold", 12, 0xffffff).setBackground(
                c.patternColor(new int[] { 0x000040, 0x000080 }, 2));

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

            // Reserve 8 pixels margins at both side of the x axis to avoid the first and last symbols
            // drawing outside of the plot area
            c.xAxis().setMargin(8, 8);

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

            // Add a line layer to the chart
            LineLayer layer = c.addLineLayer2();

            // Add the first line using small_user.png as the symbol.
            layer.addDataSet(data0, 0xcf4040, "Users").setDataSymbol2(Url.Content(
                                                                          "~/Content/small_user.png"));

            // Add the first line using small_computer.png as the symbol.
            layer.addDataSet(data1, 0x40cf40, "Computers").setDataSymbol2(Url.Content(
                                                                              "~/Content/small_computer.png"));

            // Set the line width to 3 pixels
            layer.setLineWidth(3);

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

            // Include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("", "",
                                                "title='Number of {dataSetName} at {xLabel}: {value}'");
        }
        //Main code for creating chart.
        //Note: the argument chartIndex is unused because this demo only has 1 chart.
        public void createChart(WPFChartViewer viewer, int chartIndex)
        {
            // The data for the chart
            double[]   dataY0 = { 4, 4.5, 5, 5.25, 5.75, 5.25, 5, 4.5, 4, 3, 2.5, 2.5 };
            DateTime[] dataX0 = { new DateTime(1997,                                                                                                                                                            1, 1), new DateTime(1998,                 6, 25), new DateTime(
                                      1999,                                                                                                                                                                     9, 6), new DateTime(2000,                 2,  6), new DateTime(2000,  9,21), new DateTime(2001,
                                                                                                                                                                                                                                                                                                         3,                                                                                        4), new DateTime(2001,  6,                8), new DateTime(2002,2,                4),new DateTime(2002, 5, 19
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ), new DateTime(2002,  8,               16), new DateTime(2002,  12, 1), new DateTime(2003, 1, 1) };

            double[]   dataY1 = { 7, 6.5, 6, 5, 6.5, 7, 6, 5.5, 5, 4, 3.5, 3.5 };
            DateTime[] dataX1 = { new DateTime(1997,                                                                                         1, 1), new DateTime(1997,                 7, 1), new DateTime(
                                      1997,                                                                                                 12, 1), new DateTime(1999,                 1,15), new DateTime(1999,  6,9), new DateTime(
                                      2000,                                                                                                  3, 3), new DateTime(2000,                 8,13), new DateTime(2001,  5,5), new DateTime(2001,
                                                                                                                                                                                                                     9,                    16), new DateTime(2002,  3,               16), new DateTime(2002,6,                1),new DateTime(2003, 1, 1
                                                                                                                                                                                                                                                                                                                                 ) };

            // Create a XYChart object of size 500 x 270 pixels, with a pale blue (e0e0ff)
            // background, black border, 1 pixel 3D border effect and rounded corners
            XYChart c = new XYChart(600, 300, 0xe0e0ff, 0x000000, 1);

            c.setRoundedFrame();

            // Set the plotarea at (55, 60) and of size 520 x 200 pixels, with white (ffffff)
            // background. Set horizontal and vertical grid lines to grey (cccccc).
            c.setPlotArea(50, 60, 525, 200, 0xffffff, -1, -1, 0xcccccc, 0xcccccc);

            // Add a legend box at (55, 32) (top of the chart) with horizontal layout. Use 9pt Arial
            // Bold font. Set the background and border color to Transparent.
            c.addLegend(55, 32, false, "Arial Bold", 9).setBackground(Chart.Transparent);

            // Add a title box to the chart using 15pt Times Bold Italic font. The text is white
            // (ffffff) on a deep blue (000088) background, with soft lighting effect from the right
            // side.
            c.addTitle("Long Term Interest Rates", "Times New Roman Bold Italic", 15, 0xffffff
                       ).setBackground(0x000088, -1, Chart.softLighting(Chart.Right));

            // Set the y axis label format to display a percentage sign
            c.yAxis().setLabelFormat("{value}%");

            // Add a red (ff0000) step line layer to the chart and set the line width to 2 pixels
            StepLineLayer layer0 = c.addStepLineLayer(dataY0, 0xff0000, "Country AAA");

            layer0.setXData(dataX0);
            layer0.setLineWidth(2);

            // Add a blue (0000ff) step line layer to the chart and set the line width to 2 pixels
            StepLineLayer layer1 = c.addStepLineLayer(dataY1, 0x0000ff, "Country BBB");

            layer1.setXData(dataX1);
            layer1.setLineWidth(2);

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{dataSetName} change to {value}% on {x|mmm dd, yyyy}'");
        }
        //Main code for creating chart.
        //Note: the argument chartIndex is unused because this demo only has 1 chart.
        public void createChart(WPFChartViewer viewer, int chartIndex)
        {
            // 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 = { "A", "B", "C", "D", "E", "F", "G", "H" };

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

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

            // Add a title box using grey (0x555555) 18pt Arial font
            ChartDirector.TextBox title = c.addTitle("     Pattern Recognition Accuracy", "Arial",
                                                     18, 0x555555);

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

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

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

            // Add a box whisker layer using light blue (0x99ccee) for the fill color and blue
            // (0x6688aa) for the whisker color. Set line width to 2 pixels. Use rounded corners and
            // bar lighting effect.
            BoxWhiskerLayer b = c.addBoxWhiskerLayer(Q3Data, Q1Data, Q4Data, Q0Data, Q2Data,
                                                     0x99ccee, 0x6688aa);

            b.setLineWidth(2);
            b.setRoundedCorners();
            b.setBorderColor(Chart.Transparent, Chart.barLighting());

            // Adjust the plot area to fit under the title with 10-pixel margin on the other three
            // sides.
            c.packPlotArea(10, title.getHeight(), c.getWidth() - 10, c.getHeight() - 10);

            // 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}\nInter-quartile range: " +
                                                "{bottom} to {top}'");
        }
        public byte[] CreateChart(IList<ChartItemParm> dateItem,
            string[] labels, string title, string bottom_text, string left_text, string scaleFromat)
        {
            string font_1 = "微軟正黑體";
            string font_2 = "新細明體";

            int CanvasWidth = CommWebSetup.Chart_Canvas_Width;
            int DiagramWidth = CommWebSetup.Chart_Diagram_Width;

            XYChart xyCht = new XYChart(CanvasWidth, CommWebSetup.Chart_Canvas_Height, CommWebSetup.Chart_Canvas_BgColor, CommWebSetup.Chart_Canvas_EdgeColor, 1); //設定畫布區大小
            //parm 5:奇數列顏色
            //parm 6:偶數列顏色
            //parm 7:外框顏色
            xyCht.setPlotArea(72, 90, DiagramWidth, CommWebSetup.Chart_Diagram_Height, 0xefefef, 0xfefefe, Chart.Transparent, 0x999999, 0x999999); //繪制圖表的位置及大小

            xyCht.setRoundedFrame();

            TextBox getTitleText = xyCht.addTitle(title, CommWebSetup.Chart_Title_FontFamily, CommWebSetup.Chart_Title_FontSize, CommWebSetup.Chart_Title_FontColor, CommWebSetup.Chart_Title_BgColor);
            getTitleText.setHeight(CommWebSetup.Chart_Title_Height);
            getTitleText.setAlignment(Chart.Center);

            //設定上方資訊綜合區
            LegendBox legendBox = xyCht.addLegend(72, getTitleText.getHeight(), false, font_1, 10);
            legendBox.setAlignment(Chart.TopLeft);
            legendBox.setBackground(Chart.Transparent, Chart.Transparent);

            //左側處理
            TextBox getY = xyCht.yAxis().setTitle(left_text, font_2, 14);
            getY.setFontAngle(0, true);
            xyCht.yAxis().setWidth(2);
            getY.setHeight(CommWebSetup.Chart_Diagram_Height);

            var getScaleText = xyCht.yAxis().setLabelStyle(font_2, 9);

            if (scaleFromat != null)
            {
                xyCht.yAxis().setLabelFormat(scaleFromat); //設定左邊刻度格式
                //xyCht.yAxis().setLabelFormat("{value}度");
            }

            //底部處理
            var getBottomText = xyCht.xAxis().setTitle(bottom_text, font_1,14);
            var getBottomlabel = xyCht.xAxis().setLabels(labels);
            getBottomlabel.setFontSize(9);
            getBottomlabel.setFontStyle(font_2);
            //xyCht.xAxis().setLabelStep(3); //設定Label間隔(橫向) 如果Label太密集可在此設定

            foreach (var getItem in dateItem)
            {
                LineLayer setLine = xyCht.addLineLayer2();
                setLine.addDataSet(getItem.getData, getItem.color, getItem.name).setDataSymbol(Chart.GlassSphere2Shape, 9);
                setLine.setLineWidth(2);
                setLine.setGapColor(xyCht.dashLineColor(getItem.color)); //設定無值顏色

            }
            //c.layoutLegend();
            return xyCht.makeChart(Chart.PNG);
        }
        //
        // Create chart
        //
        private void createChart(RazorChartViewer viewer)
        {
            // Data for the chart
            double[] data0  = { 100, 125, 245, 147, 67, 96, 160, 145, 97, 167, 220, 125 };
            double[] data1  = { 85, 156, 179, 211, 123, 225, 127, 99, 111, 260, 175, 156 };
            double[] data2  = { 97, 87, 56, 267, 157, 157, 67, 156, 77, 87, 197, 87 };
            string[] labels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct",
                                "Nov", "Dec" };

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

            // Add a title to the chart using 14pt Arial Bold Italic font
            c.addTitle("     Average Weekly Network Load", "Arial Bold Italic", 14);

            // Set the plotarea at (50, 50) and of 500 x 200 pixels in size. Use alternating light grey
            // (f8f8f8) / white (ffffff) background. Set border to transparent and use grey (CCCCCC)
            // dotted lines as horizontal and vertical grid lines
            c.setPlotArea(50, 50, 500, 200, 0xffffff, 0xf8f8f8, Chart.Transparent, c.dashLineColor(
                              0xcccccc, Chart.DotLine), c.dashLineColor(0xcccccc, Chart.DotLine));

            // Add a legend box at (50, 22) using horizontal layout. Use 10 pt Arial Bold Italic font,
            // with transparent background
            c.addLegend(50, 22, false, "Arial Bold Italic", 10).setBackground(Chart.Transparent);

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

            // Draw the ticks between label positions (instead of at label positions)
            c.xAxis().setTickOffset(0.5);

            // Add axis title
            c.yAxis().setTitle("Throughput (MBytes Per Hour)");

            // Set axis line width to 2 pixels
            c.xAxis().setWidth(2);
            c.yAxis().setWidth(2);

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

            layer.addDataSet(data0, 0xff0000, "Server #1");
            layer.addDataSet(data1, 0x00ff00, "Server #2");
            layer.addDataSet(data2, 0x0000ff, "Server #3");

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

            // Configure the bars within a group to touch each others (no gap)
            layer.setBarGap(0.2, Chart.TouchBar);

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

            // Include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("", "",
                                                "title='{dataSetName} on {xLabel}: {value} MBytes/hour'");
        }
示例#18
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 };
            double[] data1  = { 85, 156, 179, 211 };
            double[] data2  = { 97, 87, 56, 267 };
            string[] labels = { "1st Quarter", "2nd Quarter", "3rd Quarter",
                                "4th Quarter" };

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

            // Add a title to the chart using 14 pts Arial Bold Italic font
            c.addTitle("Annual Product Revenue", "Arial Bold Italic", 14);

            // Set the plot area at (50, 60) and of size 500 x 240. Use two
            // alternative background colors (f8f8f8 and ffffff)
            c.setPlotArea(50, 60, 500, 240, 0xf8f8f8, 0xffffff);

            // Add a legend box at (55, 22) using horizontal layout, with transparent
            // background
            c.addLegend(55, 22, false).setBackground(Chart.Transparent);

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

            // Draw the ticks between label positions (instead of at label positions)
            c.xAxis().setTickOffset(0.5);

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

            layer.addDataSet(data0, -1, "Product A");
            layer.addDataSet(data1, -1, "Product B");
            layer.addDataSet(data2, -1, "Product C");

            // Set data set 1 to use a bar shape of a 6-pointed star
            layer.setBarShape(Chart.StarShape(6), 0);

            // Set data set 2 to use a bar shapre of a 6-sided polygon
            layer.setBarShape(Chart.PolygonShape(6), 1);

            // Set data set 3 to use an X bar shape
            layer.setBarShape(Chart.Cross2Shape(), 2);

            // Add a title to the y-axis
            c.yAxis().setTitle("Revenue (USD in millions)");

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

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{dataSetName}: {xLabel} Revenue = {value} millions'");
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Data for the chart as 3 random data series
            RanSeries r = new RanSeries(127);

            double[]   data0      = r.getSeries(100, 100, -15, 15);
            double[]   data1      = r.getSeries(100, 150, -15, 15);
            double[]   data2      = r.getSeries(100, 200, -15, 15);
            DateTime[] timeStamps = r.getDateSeries(100, new DateTime(2011, 1, 1), 86400);

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

            // Add a title to the chart using 18pt Times New Roman Bold Italic font
            c.addTitle("    Product Line Global Revenue", "Times New Roman Bold Italic", 18);

            // Set the plotarea at (50, 55) with width 70 pixels less than chart width, and height 90 pixels
            // less than chart height. Use a vertical gradient from light blue (f0f6ff) to sky blue (a0c0ff)
            // as background. Set border to transparent and grid lines to white (ffffff).
            c.setPlotArea(50, 55, c.getWidth() - 70, c.getHeight() - 90, c.linearGradientColor(0, 55, 0,
                                                                                               c.getHeight() - 35, 0xf0f6ff, 0xa0c0ff), -1, Chart.Transparent, 0xffffff, 0xffffff);

            // Set legend icon style to use line style icon, sized for 8pt font
            c.getLegend().setLineStyleKey();
            c.getLegend().setFontSize(8);

            // Set axis label style to 8pt Arial Bold
            c.xAxis().setLabelStyle("Arial Bold", 8);
            c.yAxis().setLabelStyle("Arial Bold", 8);

            // Set the axis stem to transparent
            c.xAxis().setColors(Chart.Transparent);
            c.yAxis().setColors(Chart.Transparent);

            // Configure x-axis label format
            c.xAxis().setMultiFormat(Chart.StartOfYearFilter(), "{value|mm/yyyy} ", Chart.StartOfMonthFilter(
                                         ), "{value|mm}");

            // Add axis title using 10pt Arial Bold Italic font
            c.yAxis().setTitle("USD millions", "Arial Bold Italic", 10);

            // Add a line layer to the chart using a line width of 2 pixels.
            LineLayer layer = c.addLineLayer2();

            layer.setLineWidth(2);

            // Add 3 data series to the line layer
            layer.setXData(timeStamps);
            layer.addDataSet(data0, 0xff3333, "Alpha");
            layer.addDataSet(data1, 0x008800, "Beta");
            layer.addDataSet(data2, 0x3333cc, "Gamma");

            // Include track line with legend for the latest data values
            trackLineLegend(c, c.getPlotArea().getRightX());

            // Assign the chart to the WPFChartViewer
            WPFChartViewer1.Chart = c;
        }
示例#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 XYZ points for the bubble chart
            double[] dataX0 = { 170, 300, 1000, 1700 };
            double[] dataY0 = { 16, 69, 16, 75 };
            double[] dataZ0 = { 52, 105, 88, 140 };

            double[] dataX1 = { 500, 1000, 1300 };
            double[] dataY1 = { 40, 58, 85 };
            double[] dataZ1 = { 140, 202, 84 };

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

            // Set the plotarea at (70, 65) and of size 400 x 350 pixels. Turn on
            // both horizontal and vertical grid lines with light grey color
            // (0xc0c0c0)
            c.setPlotArea(70, 65, 400, 350, -1, -1, Chart.Transparent, 0xc0c0c0, -1);

            // Add a legend box at (70, 30) (top of the chart) with horizontal
            // layout. Use 12 pts Times Bold Italic font. Set the background and
            // border color to Transparent.
            c.addLegend(70, 30, false, "Times New Roman Bold Italic", 12
                        ).setBackground(Chart.Transparent);

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

            // Add titles to the axes using 12 pts Arial Bold Italic font
            c.yAxis().setTitle("Capacity (tons)", "Arial Bold Italic", 12);
            c.xAxis().setTitle("Range (miles)", "Arial Bold Italic", 12);

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

            // Add (dataX0, dataY0) as a scatter layer with red (ff3333) glass
            // spheres, where the sphere size is modulated by dataZ0. This creates a
            // bubble effect.
            c.addScatterLayer(dataX0, dataY0, "Technology AAA",
                              Chart.GlassSphere2Shape, 15, 0xff3333).setSymbolScale(dataZ0);

            // Add (dataX1, dataY1) as a scatter layer with blue (0000ff) glass
            // spheres, where the sphere size is modulated by dataZ1. This creates a
            // bubble effect.
            c.addScatterLayer(dataX1, dataY1, "Technology BBB",
                              Chart.GlassSphere2Shape, 15, 0x0000ff).setSymbolScale(dataZ1);

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='[{dataSetName}] Range = {x} miles, Capacity = {value} " +
                                                "tons, Length = {z} meters'");
        }
        //
        // Draw the chart and display it in the given viewer.
        //
        private void drawChart2(WPFChartViewer viewer)
        {
            // Create an XYChart object 600 x 270 pixels in size, with light grey (f4f4f4)
            // background, black (000000) border, 1 pixel raised effect, and with a rounded frame.
            XYChart c = new XYChart(600, 270, 0xf4f4f4, 0x000000, 1);

            c.setRoundedFrame(0xffffff);

            // Set the plotarea at (55, 62) and of size 520 x 175 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.
            c.setPlotArea(55, 62, 520, 175, 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
            c.setClipping();

            // Add a title to the chart using 15 pts Times New Roman Bold Italic font, with a light
            // grey (dddddd) background, black (000000) border, and a glass like raised effect.
            c.addTitle("Fast Fourier Transform", "Times New Roman Bold Italic", 15
                       ).setBackground(0xdddddd, 0x000000, Chart.glassEffect());

            // Add a legend box at the top of the plot area with 9pts Arial Bold font. We set the
            // legend box to the same width as the plot area and use grid layout (as opposed to
            // flow or top/down layout). This distributes the 3 legend icons evenly on top of the
            // plot area.
            LegendBox b = c.addLegend2(55, 33, 1, "Arial Bold", 9);

            b.setBackground(Chart.Transparent, Chart.Transparent);
            b.setWidth(520);

            // Configure the y-axis with a 10pts Arial Bold axis title
            c.yAxis().setTitle("Magnitude", "Arial Bold", 10);

            // Configure the x-axis to auto-scale with at least 75 pixels between major tick and 15
            // pixels between minor ticks. This shows more minor grid lines on the chart.
            c.xAxis().setTickDensity(75, 15);

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

            // c.yAxis().setDateScale(0, 600);

            // Set the x-axis label format
            //c.xAxis().setLabelFormat("{0:0.##}");

            // Create a line layer to plot the lines
            LineLayer layer = c.addLineLayer2();

            // Perform FFT if the option is chosen
            if (this.ShowFFT)
            {
                this.fftBuffer = this.computeNormalizedFFT(this.fftLength, this.fftOutLength);
            }
            // Add data to the layer
            layer.addDataSet(this.fftBuffer, 0xff0000);
            // Assign the chart to the WinChartViewer
            viewer.Chart = c;
        }
        //Main code for creating chart.
        //Note: the argument chartIndex is unused because this demo only has 1 chart.
        public void createChart(WPFChartViewer viewer, int chartIndex)
        {
            // Use random table to generate a random series. The random table is set to 1 col x 51
            // rows, with 9 as the seed
            RanTable rantable = new RanTable(9, 1, 51);

            // Set the 1st column to start from 100, with changes between rows from -5 to +5
            rantable.setCol(0, 100, -5, 5);

            // Get the 1st column of the random table as the data set
            double[] data = rantable.getCol(0);

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

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

            // Add a title to the chart using 18 point Times Bold Itatic font.
            c.addTitle("LOWESS Generic Curve Fitting Algorithm", "Times New Roman Bold Italic", 18);

            // Set the y axis line width to 3 pixels
            c.yAxis().setWidth(3);

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

            // Set the x axis line width to 3 pixels
            c.xAxis().setWidth(3);

            // Set the x axis scale from 0 - 50, with major tick every 5 units and minor tick every
            // 1 unit
            c.xAxis().setLinearScale(0, 50, 5, 1);

            // Add a blue layer to the chart
            LineLayer layer = c.addLineLayer2();

            // Add a red (0x80ff0000) data set to the chart with square symbols
            layer.addDataSet(data, unchecked ((int)0x80ff0000)).setDataSymbol(Chart.SquareSymbol);

            // Set the line width to 2 pixels
            layer.setLineWidth(2);

            // Use lowess for curve fitting, and plot the fitted data using a spline layer with line
            // width set to 3 pixels
            c.addSplineLayer(new ArrayMath(data).lowess().result(), 0x0000ff).setLineWidth(3);

            // Set zero affinity to 0 to make sure the line is displayed in the most detail scale
            c.yAxis().setAutoScale(0, 0, 0);

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='({x}, {value|2})'");
        }
示例#23
0
        //Main code for creating chart.
        //Note: the argument chartIndex is unused because this demo only has 1 chart.
        public void createChart(WPFChartViewer viewer, int chartIndex)
        {
            // The XYZ points for the bubble chart
            double[] dataX0 = { 150, 300, 1000, 1700 };
            double[] dataY0 = { 12, 60, 25, 65 };
            double[] dataZ0 = { 20, 50, 50, 85 };

            double[] dataX1 = { 500, 1000, 1300 };
            double[] dataY1 = { 35, 50, 75 };
            double[] dataZ1 = { 30, 55, 95 };

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

            // Set the plotarea at (55, 65) 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, 65, 350, 300, -1, -1, 0xc0c0c0, 0xc0c0c0, -1);

            // Add a legend box at (50, 30) (top of the chart) with horizontal layout. Use 12pt
            // Times Bold Italic font. Set the background and border color to Transparent.
            c.addLegend(50, 30, false, "Times New Roman Bold Italic", 12).setBackground(
                Chart.Transparent);

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

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

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

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

            // Add (dataX0, dataY0) as a scatter layer with semi-transparent red (0x80ff3333) circle
            // symbols, where the circle size is modulated by dataZ0. This creates a bubble effect.
            c.addScatterLayer(dataX0, dataY0, "Technology AAA", Chart.CircleSymbol, 9,
                              unchecked ((int)0x80ff3333), unchecked ((int)0x80ff3333)).setSymbolScale(dataZ0);

            // Add (dataX1, dataY1) as a scatter layer with semi-transparent green (0x803333ff)
            // circle symbols, where the circle size is modulated by dataZ1. This creates a bubble
            // effect.
            c.addScatterLayer(dataX1, dataY1, "Technology BBB", Chart.CircleSymbol, 9,
                              unchecked ((int)0x803333ff), unchecked ((int)0x803333ff)).setSymbolScale(dataZ1);

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='[{dataSetName}] Range = {x} miles, Capacity = {value} tons, Length = {z} " +
                                                "meters'");
        }
示例#24
0
        private void UpdatePlot(object sender, RunWorkerCompletedEventArgs e)
        {
            List <object> objlist = new List <object>();

            objlist.AddRange((List <object>)e.Result);
            double[] depart    = (double[])objlist[0];
            double[] arrive    = (double[])objlist[1];
            double[] departVel = (double[])objlist[2];
            string   Plan1Name = (string)objlist[3];
            string   Plan2Name = (string)objlist[4];

            XYChart c = new XYChart(800, 800);

            c.setPlotArea(75, 40, 600, 600, -1, -1, -1, c.dashLineColor(unchecked ((int)0x80000000), Chart.DotLine), -1);
            // When auto-scaling, use tick spacing of 40 pixels as a guideline
            c.yAxis().setTickDensity(40);
            c.xAxis().setTickDensity(40);


            // Add a contour layer using the given data
            ContourLayer layer = c.addContourLayer(depart, arrive, departVel);

            c.getPlotArea().moveGridBefore(layer);
            ColorAxis cAxis = layer.setColorAxis(700, 40, Chart.TopLeft, 400, Chart.Right);

            double[] colorScale = { 3, 0x090446, 3.3, 0x16366B, 3.6, 0x236890, 3.9, 0x309AB5, 4.2, 0x53C45A, 4.5, 0x77EF00, 4.8, 0xBBF70F, 5.1, 0xFFFF1E, 5.4, 0xFF8111, 5.7, 0xFF0404 };
            cAxis.setColorScale(colorScale, 0x090446, 0xffffff);
            cAxis.setColorGradient(false);
            // Add a title to the color axis using 12 points Arial Bold Italic font
            cAxis.setTitle("Departure Velocity (km/s)", "Arial Bold Italic", 12);
            c.xAxis().setTitle("Departure Date (JDCT)");
            c.yAxis().setTitle("Arrival Date (JDCT)");
            c.addTitle("Departure Velocity from " + Plan1Name + " to " + Plan2Name);
            c.xAxis().setTickLength(10);
            c.yAxis().setTickLength(10);


            // Output the chart
            winChartViewer1.Chart    = c;
            winChartViewer1.ImageMap = c.getHTMLImageMap("");

            /*
             *          // 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" };
             *
             * XYChart c = new XYChart(250, 250);
             * c.setPlotArea(30, 20, 200, 200);
             * c.addBarLayer(data);
             * c.xAxis().setLabels(labels);
             * winChartViewer1.Chart = c;
             */
        }
示例#25
0
        //
        // Create chart
        //
        private void createChart(RazorChartViewer viewer)
        {
            // The data for the bar chart
            double[] data = { -6.3, 2.3, 0.7, -3.4, 2.2, -2.9, -0.1, -0.1, 3.3, 6.2, 4.3, 1.6 };

            // The labels for the bar chart
            string[] labels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
                                "Nov", "Dec" };

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

            // Add a title to the chart using Arial Bold Italic font
            c.addTitle("Productivity Change - Year 2005", "Arial Bold Italic");

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

            // Add a bar layer to the chart using the Overlay data combine method
            BarLayer layer = c.addBarLayer2(Chart.Overlay);

            // Select positive data and add it as data set with blue (6666ff) color
            layer.addDataSet(new ArrayMath(data).selectGEZ(null, Chart.NoValue).result(), 0x6666ff);

            // Select negative data and add it as data set with orange (ff6600) color
            layer.addDataSet(new ArrayMath(data).selectLTZ(null, Chart.NoValue).result(), 0xff6600);

            // Add labels to the top of the bar using 8 pt Arial Bold font. The font color is configured
            // to be red (0xcc3300) below zero, and blue (0x3333ff) above zero.
            layer.setAggregateLabelStyle("Arial Bold", 8, layer.yZoneColor(0, 0xcc3300, 0x3333ff));

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

            // Draw the y axis on the right of the plot area
            c.setYAxisOnRight(true);

            // Use Arial Bold as the y axis label font
            c.yAxis().setLabelStyle("Arial Bold");

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

            // Add a light blue (0xccccff) zone for positive part of the plot area
            c.yAxis().addZone(0, 9999, 0xccccff);

            // Add a pink (0xffffcc) zone for negative part of the plot area
            c.yAxis().addZone(-9999, 0, 0xffcccc);

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

            // Include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("", "", "title='{xLabel}: {value}%'");
        }
示例#26
0
        //
        // Create chart
        //
        private void createChart(RazorChartViewer viewer)
        {
            // Data for the chart as 3 random data series
            RanSeries r = new RanSeries(127);

            double[]   data0      = r.getSeries(100, 100, -15, 15);
            double[]   data1      = r.getSeries(100, 150, -15, 15);
            double[]   data2      = r.getSeries(100, 200, -15, 15);
            DateTime[] timeStamps = r.getDateSeries(100, new DateTime(2011, 1, 1), 86400);

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

            // Add a title to the chart using 18pt Times New Roman Bold Italic font
            c.addTitle("    Product Line Global Revenue", "Times New Roman Bold Italic", 18);

            // Set the plotarea at (50, 55) with width 70 pixels less than chart width, and height 90
            // pixels less than chart height. Use a vertical gradient from light blue (f0f6ff) to sky
            // blue (a0c0ff) as background. Set border to transparent and grid lines to white (ffffff).
            c.setPlotArea(50, 55, c.getWidth() - 70, c.getHeight() - 90, c.linearGradientColor(0, 55, 0,
                                                                                               c.getHeight() - 35, 0xf0f6ff, 0xa0c0ff), -1, Chart.Transparent, 0xffffff, 0xffffff);


            // Set axis label style to 8pt Arial Bold
            c.xAxis().setLabelStyle("Arial Bold", 8);
            c.yAxis().setLabelStyle("Arial Bold", 8);

            // Set the axis stem to transparent
            c.xAxis().setColors(Chart.Transparent);
            c.yAxis().setColors(Chart.Transparent);

            // Configure x-axis label format
            c.xAxis().setMultiFormat(Chart.StartOfYearFilter(), "{value|mm/yyyy} ",
                                     Chart.StartOfMonthFilter(), "{value|mm}");

            // Add axis title using 10pt Arial Bold Italic font
            c.yAxis().setTitle("USD millions", "Arial Bold Italic", 10);

            // Add a line layer to the chart using a line width of 2 pixels.
            LineLayer layer = c.addLineLayer2();

            layer.setLineWidth(2);

            // Add 3 data series to the line layer
            layer.setXData(timeStamps);
            layer.addDataSet(data0, 0xff3333, "Alpha");
            layer.addDataSet(data1, 0x008800, "Beta");
            layer.addDataSet(data2, 0x3333cc, "Gamma");

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

            // Output Javascript chart model to the browser to suppport tracking cursor
            viewer.ChartModel = c.getJsChartModel();
        }
示例#27
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 XY points for the scatter chart
            double[] dataX0 = { 10, 15, 6, 12, 14, 8, 13, 13, 16, 12, 10.5 };
            double[] dataY0 = { 130, 150, 80, 110, 110, 105, 130, 115, 170, 125, 125 };

            double[] dataX1 = { 6, 12, 4, 3.5, 7, 8, 9, 10, 12, 11, 8 };
            double[] dataY1 = { 65, 80, 40, 45, 70, 80, 80, 90, 100, 105, 60 };

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

            // Set the plotarea at (55, 65) 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, 65, 350, 300, -1, -1, 0xc0c0c0, 0xc0c0c0, -1);

            // Add a legend box at (50, 30) (top of the chart) with horizontal
            // layout. Use 12 pts Times Bold Italic font. Set the background and
            // border color to Transparent.
            c.addLegend(50, 30, false, "Times New Roman Bold Italic", 12
                        ).setBackground(Chart.Transparent);

            // Add a title to the chart using 18 pts Times Bold Itatic font.
            c.addTitle("Genetically Modified Predator",
                       "Times New Roman Bold Italic", 18);

            // Add a title to the y axis using 12 pts Arial Bold Italic font
            c.yAxis().setTitle("Length (cm)", "Arial Bold Italic", 12);

            // Add a title to the x axis using 12 pts Arial Bold Italic font
            c.xAxis().setTitle("Weight (kg)", "Arial Bold Italic", 12);

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

            // Add an orange (0xff9933) scatter chart layer, using 13 pixel diamonds
            // as symbols
            c.addScatterLayer(dataX0, dataY0, "Genetically Engineered",
                              Chart.DiamondSymbol, 13, 0xff9933);

            // Add a green (0x33ff33) scatter chart layer, using 11 pixel triangles
            // as symbols
            c.addScatterLayer(dataX1, dataY1, "Natural", Chart.TriangleSymbol, 11,
                              0x33ff33);

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='[{dataSetName}] Weight = {x} kg, Length = {value} cm'");
        }
示例#28
0
        public void LoadChart(double[] data)
        {
            // The data for the line chart
            //  double[] data0 = { 60.2, 51.7, 81.3, 48.6, 56.2, 68.9, 52.8 };
            //  double[] data1 = { 30.0, 32.7, 33.9, 29.5, 32.2, 28.4, 29.8 };
            string[] labels = new string [31];
            for (int iDay = 0; iDay < 31; iDay++)
            {
                labels[iDay] = ((int)(iDay + 1)).ToString();
            }
            // Create a XYChart object of size 300 x 180 pixels, with a pale yellow
            // (0xffffc0) background, a black border, and 1 pixel 3D border effect.
            //834, 207
            XYChart c = new XYChart(800, 190, 0xffffc0, 0x000000, 1);

            // Set the plotarea at (45, 35) and of size 240 x 120 pixels, with white
            // background. Turn on both horizontal and vertical grid lines with light
            // grey color (0xc0c0c0)
            c.setPlotArea(30, 20, 760, 150, 0xffffff, -1, -1, 0xc0c0c0, -1);

            // Add a legend box at (45, 12) (top of the chart) using horizontal
            // layout and 8 pts Arial font Set the background and border color to
            // Transparent.
            c.addLegend(45, 12, false, "", 8).setBackground(Chart.Transparent);

            // Add a title to the chart using 9 pts Arial Bold/white font. Use a 1 x
            // 2 bitmap pattern as the background.
            c.addTitle("Biều đồ khách môi giới theo ngày (Tháng " + calTuNgay.Value.Month.ToString() + " )", "Arial Bold", 9, 0xffffff
                       ).setBackground(c.patternColor(new int[] { 0x004000, 0x008000 }, 2));

            // Set the y axis label format to nn%
            c.yAxis().setLabelFormat("{value}");

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

            // Add a line layer to the chart
            LineLayer layer = c.addLineLayer();

            // Add the first line. Plot the points with a 7 pixel square symbol
            layer.addDataSet(data, 0xcf4040, "Số xe đón").setDataSymbol(
                Chart.SquareSymbol, 7);


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

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{xLabel}: {dataSetName} {value}'");
        }
示例#29
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[] data = { 450, 560, 630, 800, 1100, 1350, 1600, 1950, 2300, 2700 };

            // The labels for the bar chart
            string[] labels = { "1996", "1997", "1998", "1999", "2000", "2001",
                                "2002", "2003", "2004", "2005" };

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

            // Set the plotarea at (60, 40) and of size 480 x 280 pixels. Use a
            // vertical gradient color from light blue (eeeeff) to deep blue (0000cc)
            // as background. Set border and grid lines to white (ffffff).
            c.setPlotArea(60, 40, 480, 280, c.linearGradientColor(60, 40, 60, 280,
                                                                  0xeeeeff, 0x0000cc), -1, 0xffffff, 0xffffff);

            // Add a title to the chart using 18pts Times Bold Italic font
            c.addTitle("Annual Revenue for Star Tech", "Times New Roman Bold Italic",
                       18);

            // Add a multi-color bar chart layer using the supplied data. Use glass
            // lighting effect with light direction from the left.
            c.addBarLayer3(data).setBorderColor(Chart.Transparent, Chart.glassEffect(
                                                    Chart.NormalGlare, Chart.Left));

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

            // Show the same scale on the left and right y-axes
            c.syncYAxis();

            // Set the left y-axis and right y-axis title using 10pt Arial Bold font
            c.yAxis().setTitle("USD (millions)", "Arial Bold", 10);
            c.yAxis2().setTitle("USD (millions)", "Arial Bold", 10);

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

            // Set the label styles of all axes to 8pt Arial Bold font
            c.xAxis().setLabelStyle("Arial Bold", 8);
            c.yAxis().setLabelStyle("Arial Bold", 8);
            c.yAxis2().setLabelStyle("Arial Bold", 8);

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='Year {xLabel}: US$ {value}M'");
        }
示例#30
0
        //Main code for creating charts
        public void createChart(WinChartViewer viewer, int chartIndex)
        {
            double bargap = chartIndex * 0.25 - 0.25;

            // The data for the bar chart
            double[] data = { 100, 125, 245, 147, 67 };

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

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

            // Set the plotarea at (27, 20) and of size 120 x 100 pixels
            c.setPlotArea(27, 20, 120, 100);

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

            if (bargap >= 0)
            {
                // Add a title to display to bar gap using 8pt Arial font
                c.addTitle("      Bar Gap = " + bargap, "Arial", 8);
            }
            else
            {
                // Use negative value to mean TouchBar
                c.addTitle("      Bar Gap = TouchBar", "Arial", 8);
                bargap = Chart.TouchBar;
            }

            // Add a bar chart layer using the given data and set the bar gap
            c.addBarLayer(data).setBarGap(bargap);

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='Production on {xLabel}: {value} kg'");
        }
示例#31
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 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, 45, 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 = { 61, 79, 85, 66, 53, 39, 24, 21, 37, 56, 37, 22, 21, 33,
                               13, 17,  4, 23, 16, 25,  9, 10,  5,  7, 16 };
            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 500 x 300 pixels
            XYChart c = new XYChart(500, 300);

            // Set the plotarea at (90, 30) and of size 300 x 240 pixels.
            c.setPlotArea(90, 30, 300, 240);

            // Add a legend box at (405, 100)
            c.addLegend(405, 100);

            // Add a title to the chart
            c.addTitle("Daily System Load");

            // Add a title to the y axis. Draw the title upright (font angle = 0)
            c.yAxis().setTitle("Database\nQueries\n(per sec)").setFontAngle(0);

            // 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 an area layer
            AreaLayer layer = c.addAreaLayer();

            // Draw the area layer in 3D
            layer.set3D();

            // Add the three data sets to the area layer
            layer.addDataSet(data0, -1, "Server # 1");
            layer.addDataSet(data1, -1, "Server # 2");
            layer.addDataSet(data2, -1, "Server # 3");

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{dataSetName} load at hour {xLabel}: {value} queries/sec'");
        }
示例#32
0
    private void SetMonthlyGraph()
    {
        int yearFrom = Convert.ToInt32((txtYearFrom.Text.Trim() == "" ? "0" : txtYearFrom.Text.Trim())) - 543;
        int yearTo = Convert.ToInt32((txtYearTo.Text.Trim() == "" ? "0" : txtYearTo.Text.Trim())) - 543;
        int currentmonth = 0;

        if (yearFrom < 0)
            yearFrom = 0;
        if (yearTo < 0)
            yearTo = 0;
        int tmp = yearFrom;
        if (yearFrom > yearTo)
        {
            yearFrom = yearTo;
            yearTo = tmp;
        }
        yearFrom += 543;
        yearTo += 543;

        switch (Request["currentyear"])
        {
            case "Á.¤.":
                currentmonth = 1;
                break;

            case "¡.¾.":
                currentmonth = 2;
                break;

            case "ÁÕ.¤.":
                currentmonth = 3;
                break;

            case "àÁ.Â.":
                currentmonth = 4;
                break;

            case "¾.¤.":
                currentmonth = 5;
                break;

            case "ÁÔ.Â.":
                currentmonth = 6;
                break;

            case "¡.¤.":
                currentmonth = 7;
                break;

            case "Ê.¤.":
                currentmonth = 8;
                break;

            case "¡.Â.":
                currentmonth = 9;
                break;

            case "µ.¤.":
                currentmonth = 10;
                break;

            case "¾.Â.":
                currentmonth = 11;
                break;

            case "¸.¤.":
                currentmonth = 12;
                break;
        }
        this.lnkYear.Text = GetTitle() + (yearFrom == yearTo ? "ã¹»Õ ¾.È. " + yearFrom.ToString() : " µÑé§áµè»Õ ¾.È. " + yearFrom.ToString() + "-" + yearTo.ToString());
        this.lblMonth.Text = ">> à´×͹ " + Request["currentyear"].ToString();
        this.pnlMonth.Visible = true;
        string[] labels = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" };

        XYChart c = new XYChart(750, 380, 15663086, 14540253, 0);
        string title = GetTitle() + (yearFrom == yearTo ? "ã¹»Õ ¾.È. " + yearFrom.ToString() : " µÑé§áµè»Õ ¾.È. " + yearFrom.ToString() + "-" + yearTo.ToString());
        c.addTitle(title, "Tahoma Bold", 12);

        c.setPlotArea(70, 80, 640, 230, c.gradientColor(0, 60, 0, 350, 16777215, 11189196), -1, Chart.Transparent, 1111);

        c.addLegend(30, 25, false, "Tahoma Bold", 8).setBackground(Chart.Transparent);
        c.xAxis().setLabels(labels);
        c.yAxis().setTickDensity(30);
        c.xAxis().setLabelStyle("Tahoma", 8, 001122, 90);
        c.yAxis().setLabelStyle("Tahoma", 8);
        c.yAxis().setLabelFormat("{value|0,}");
        c.xAxis().setWidth(2);
        c.yAxis().setWidth(2);
        c.yAxis().setTitle("¨Ó¹Ç¹", "Tahoma Bold", 10);
        c.xAxis().setTitle("Çѹ·Õè", "Tahoma Bold", 10);

        LineLayer layer = c.addLineLayer();
        layer.setLineWidth(1);
        AddData(layer, yearFrom - 543, yearTo - 543, currentmonth);
        vwChart.Image = c.makeWebImage(Chart.PNG);
        vwChart.ImageMap = c.getHTMLImageMap("", "", "title='Çѹ·Õè {xLabel}\r\n{value|,} ÃÒ¡Òà ({percent}%)'");
        this.pnlChart.Visible = true;
    }
示例#33
0
    private void SetYearlyGraph()
    {
        int yearFrom = Convert.ToInt32((txtYearFrom.Text.Trim() == "" ? "0" : txtYearFrom.Text.Trim())) - 543;
        int yearTo = Convert.ToInt32((txtYearTo.Text.Trim() == "" ? "0" : txtYearTo.Text.Trim())) - 543;
        if (yearFrom < 0)
            yearFrom = 0;
        if (yearTo < 0)
            yearTo = 0;
        int tmp = yearFrom;
        if (yearFrom > yearTo)
        {
            yearFrom = yearTo;
            yearTo = tmp;
        }
        yearFrom += 543;
        yearTo += 543;

        string[] labels = { "Á.¤.", "¡.¾.", "ÁÕ.¤.", "àÁ.Â.", "¾.¤.", "ÁÔ.Â.", "¡.¤.", "Ê.¤.", "¡.Â.", "µ.¤.", "¾.Â.", "¸.¤." };

        XYChart c = new XYChart(750, 380, 15663086, 14540253, 0);
        string title = GetTitle() + (yearFrom == yearTo ? "ã¹»Õ ¾.È. " + yearFrom.ToString() : " µÑé§áµè»Õ ¾.È. " + yearFrom.ToString() + "-" + yearTo.ToString());
        c.addTitle(title, "Tahoma Bold", 12);

        c.setPlotArea(70, 80, 640, 230, c.gradientColor(0, 60, 0, 350, 16777215, 11189196), -1, Chart.Transparent, 1111);

        c.addLegend(30, 25, false, "Tahoma Bold", 8).setBackground(Chart.Transparent);
        c.xAxis().setLabels(labels);
        c.yAxis().setTickDensity(30);
        c.xAxis().setLabelStyle("Tahoma", 8, 001122, 90);
        c.yAxis().setLabelStyle("Tahoma", 8);
        c.yAxis().setLabelFormat("{value|0,}");
        c.xAxis().setWidth(2);
        c.yAxis().setWidth(2);
        c.yAxis().setTitle("¨Ó¹Ç¹", "Tahoma Bold", 10);
        c.xAxis().setTitle("à´×͹", "Tahoma Bold", 10);

        LineLayer layer = c.addLineLayer();
        layer.setLineWidth(1);
        AddData(layer, yearFrom - 543, yearTo - 543);
        vwChart.Image = c.makeWebImage(Chart.PNG);
        vwChart.ImageMap = c.getHTMLImageMap(GetReportPath() + "?type=" + Request["type"] + "&warehouse=" + this.cmbWarehouse.SelectedItem.Value.ToString() + "&producttype=" + this.cmbProductType.SelectedItem.Value.ToString() + "&productgroup=" + this.cmbProductGroup.SelectedItem.Value.ToString() + "&product=" + this.cmbProduct.SelectedItem.Value.ToString() + "&currentyear={xLabel}&yearfrom=" + yearFrom.ToString() + "&yearto=" + yearTo.ToString(), "",
            "title='»Õ {dataSetName} à´×͹ {xLabel}\r\n{value|,} ÃÒ¡Òà ({percent}%)'");
    }
示例#34
0
        /// <summary>
        /// This method uses the Chart Director API to plot the histogram
        /// </summary>
        /// <param name="chartWidth"></param>
        /// <param name="chartHeight"></param>
        /// <param name="data"></param>
        /// <param name="labels"></param>
        /// <param name="title"></param>
        /// <param name="xAxisLabel"></param>
        /// <param name="yAxisLabel"></param>
        private void plot(int chartWidth, int chartHeight, double[] data, string[] labels, string title, string xAxisLabel, string yAxisLabel)
        {
            // Create a XYChart object of size chartWidth x chartHeight pixels
            XYChart chart = new XYChart(chartWidth, chartHeight);

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

            // Add a title box using grey (0x555555) 24pt Arial Bold font
            chart.addTitle(title, "Arial Bold", 24, 0x555555);

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

            // Set the x and y axis stems to transparent and the label font to 10pt Arial
            chart.xAxis().setColors(Chart.Transparent);
            chart.yAxis().setColors(Chart.Transparent);

            // Use 10 points Arial rotated by 45 degrees as the x-axis label font
            chart.xAxis().setLabelStyle("Arial", 10, Chart.TextColor, 45);
            chart.yAxis().setLabelStyle("Arial", 10);

            // Add a blue (0x6699bb) bar chart layer using the given data
            BarLayer layer = chart.addBarLayer(data, 0x6699bb);

            // Use bar gradient lighting with the light intensity from 0.8 to 1.3
            layer.setBorderColor(Chart.Transparent, Chart.barLighting(0.8, 1.3));

            // Set rounded corners for bars
            layer.setRoundedCorners();

            // Display labela on top of bars using 10pt Arial font
            layer.setAggregateLabelStyle("Arial", 10);

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

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

            // Add a title to the y axis using dark grey (0x555555) 12pt Arial Bold font
            chart.yAxis().setTitle(yAxisLabel, "Arial Bold", 12, 0x555555);

            // Add a title to the x axis using dark grey (0x555555) 12pt Arial Bold font
            chart.xAxis().setTitle(xAxisLabel, "Arial Bold", 12, 0x555555);

            //output the chart
            chartViewer.Chart = chart;
        }
示例#35
0
		private void buildMultiBarChart() {

			int topMargin = 30;
			int bottomnMargin = 60;
			int leftMargin = 50;
			int rightMargin = 150;

			MultiBarChartData data = (MultiBarChartData)this.chartData;
			this.Text = data.Title;
			XYChart barChart = new XYChart(this.chartPanel.Size.Width, this.chartPanel.Size.Height, 0xeeeeff, -1, 2);

			barChart.setPlotArea(leftMargin, topMargin, this.chartPanel.Size.Width - (leftMargin + rightMargin),
				this.chartPanel.Size.Height - (topMargin + bottomnMargin), 0xffffff, -1, -1, 0xcccccc, 0xcccccc);

			barChart.addTitle(data.Title);

			barChart.addLegend(Size.Width - (rightMargin - 5), topMargin, true, "Arial Bold", 9).setBackground(
				ChartDirector.Chart.Transparent);

			// Set the labels on the x axis.
			barChart.xAxis().setLabels(data.XLabels);

			// Add a multi-bar chart layer using the given data
			ChartDirector.BarLayer layer = barChart.addBarLayer2(ChartDirector.Chart.Side, data.BarLayers.Length);
			foreach (BarLayer barLayer in data.BarLayers) {
				layer.addDataSet(barLayer.Data, -1, barLayer.Label);
			}

			// output the chart
			this.chartPanel.Image = barChart.makeImage();
		}
示例#36
0
        public byte[] CreateBar(double[] dateItem,
                                    string[] labels, string title, string bottom_text, string left_text, string scaleFromat)
        {
            string font_1 = "微軟正黑體";
            string font_2 = "新細明體";

            int CanvasWidth = CommWebSetup.Chart_Canvas_Width;
            int DiagramWidth = CommWebSetup.Chart_Diagram_Width;

            XYChart xyCht = new XYChart(CanvasWidth, CommWebSetup.Chart_Canvas_Height, 0xffffff, 0xffffff, 0); //設定畫布區大小
            //parm 5:奇數列顏色
            //parm 6:偶數列顏色
            //parm 7:外框顏色
            xyCht.setPlotArea(60, 72, DiagramWidth, CommWebSetup.Chart_Diagram_Height, 0xffffff, 0xffffff, 0xffffff, 0x999999, 0xffffff); //繪制圖表的位置及大小

            xyCht.setRoundedFrame();

            TextBox getTitleText = xyCht.addTitle(title, CommWebSetup.Chart_Title_FontFamily, CommWebSetup.Chart_Title_FontSize, CommWebSetup.Chart_Title_FontColor, 0xffffff);
            getTitleText.setHeight(CommWebSetup.Chart_Title_Height);
            getTitleText.setAlignment(Chart.Center);

            //設定上方資訊綜合區
            LegendBox legendBox = xyCht.addLegend(72, getTitleText.getHeight(), false, font_1, 10);
            legendBox.setAlignment(Chart.TopLeft);
            legendBox.setBackground(Chart.Transparent, Chart.Transparent);

            //左側處理
            TextBox getY = xyCht.yAxis().setTitle(left_text, font_2, 14);
            getY.setFontAngle(0, true);
            xyCht.yAxis().setWidth(2);
            getY.setHeight(CommWebSetup.Chart_Diagram_Height);

            var getScaleText = xyCht.yAxis().setLabelStyle(font_2, 9);

            if (scaleFromat != null)
            {
                xyCht.yAxis().setLabelFormat(scaleFromat); //設定左邊刻度格式
                //xyCht.yAxis().setLabelFormat("{value}度");
            }

            //底部處理
            var getBottomText = xyCht.xAxis().setTitle(bottom_text, font_1, 14);
            var getBottomlabel = xyCht.xAxis().setLabels(labels);
            getBottomlabel.setFontSize(9);
            getBottomlabel.setFontStyle(font_2);
            //xyCht.xAxis().setLabelStep(3); //設定Label間隔(橫向) 如果Label太密集可在此設定
            var col1 = Convert.ToInt32("EA8D8D", 16);
            var col2 = Convert.ToInt32("FFE699", 16);
            var col3 = Convert.ToInt32("9DC3E6", 16);
            var col4 = Convert.ToInt32("70AD47", 16);
            var col5 = Convert.ToInt32("ED7D31", 16);

            var colors = new int[] { col1, col2, col3, col4, col5 };
            //var names = new string[] { "紅一", "紅二", "紅三", "紅四", "紅五" };

            var layer = xyCht.addBarLayer3(dateItem, colors);
            layer.setAggregateLabelStyle("Arial", 8);
            layer.setBarWidth(32);

            return xyCht.makeChart(Chart.PNG);
        }
示例#37
0
    private void SetYearlyProductGraph()
    {
        this.pnlMonth.Visible = false;
        int yearFrom = Convert.ToInt32(this.txtYearFrom.Text == "" ? "0" : this.txtYearFrom.Text)-543;
        int yearTo = Convert.ToInt32(this.txtYearTo.Text == "" ? "0" : this.txtYearTo.Text)-543;
        string BarcodeFrom = this.txtBarcodeFrom.Text;
        string BarcodeTo = this.txtBarcodeTo.Text;
        if (yearFrom <0) yearFrom =0;
        if (yearTo < 0) yearTo = 0;
        int temp = yearFrom;
        if (yearFrom > yearTo)
        {
            yearFrom = yearTo;
            yearTo = temp;
        }
        yearFrom += 543;
        yearTo += 543;
        string[] labels = GetXLabel(yearFrom, yearTo);
        XYChart c = new XYChart(750, 380, 15663086, 14540253, 0);
        string title = GetReportTitle() + (yearFrom == yearTo ? "ã¹»Õ ¾.È. " + yearFrom.ToString() : " µÑé§áµè»Õ ¾.È. " + yearFrom.ToString() + "-" + yearTo.ToString());

        c.addTitle(title, "Tahoma Bold",12);
        c.setPlotArea(70, 80, 640, 230, c.gradientColor(0, 60, 0, 350, 16777215, 11189196), -1, Chart.Transparent, 1111);
        c.addLegend(30, 25, false, "Tahoma Bold", 8).setBackground(Chart.Transparent);c.xAxis().setLabels(labels);
        c.yAxis().setTickDensity(30);
        c.xAxis().setLabelStyle("Tahoma", 8, 001122, 90);
        c.yAxis().setLabelStyle("Tahoma", 8);
        c.yAxis().setLabelFormat("{value|0,}");
        c.xAxis().setWidth(2);
        c.yAxis().setWidth(2);
        c.yAxis().setTitle("¨Ó¹Ç¹ÊÔ¹¤éÒ/Çѵ¶Ø´Ôº", "Tahoma Bold", 10);
        c.xAxis().setTitle("»Õ ¾.È.", "Tahoma Bold", 10);

        LineLayer layer = c.addLineLayer();
        layer.setLineWidth(1);
        AddData(layer, yearFrom - 543, yearTo - 543,BarcodeFrom,BarcodeTo);
        vwChart.Image = c.makeWebImage(Chart.PNG);
        vwChart.ImageMap = c.getHTMLImageMap(GetReportPath()+ "?type=" + Request["type"] +  "&producegroup=" + this.cmbProduceGroup.SelectedItem.Value.ToString() + "&BarcodeFrom =" + this.txtBarcodeFrom.Text + "&BarcodeTo =" + this.txtBarcodeTo.Text+ "&currentyear={xLabel}&yearfrom=" + yearFrom.ToString() + "&yearto=" + yearTo.ToString(), "",
            "title='{dataSetName} ã¹»Õ {xLabel}\r\n{value|,} ÃÒ¡Òà ({percent}%)'");
    }
示例#38
0
    private void SetDatelyProductGraph()
    {
        this.pnlMonth.Visible = false;
        DateTime DateFrom = this.ctlDateFrom.DateValue;
        DateTime DateTo = this.ctlDateTo.DateValue;
        string BarcodeFrom = this.txtBarcodeFrom.Text;
        string BarcodeTo = this.txtBarcodeTo.Text;
        DateTime temp = DateFrom;
        if (DateFrom > DateTo)
        {
            DateFrom = DateTo;
            DateTo = temp;
        }
        string[] labels = GetDateXLabel(DateFrom, DateTo);
        XYChart c = new XYChart(750, 380, 15663086, 14540253, 0);
        string title = GetReportTitle() + (DateFrom == DateTo ? "ã¹Çѹ·Õè " + DateFrom.ToString() : " µÑé§áµèÇѹ·Õè " + DateFrom.ToString().Substring(0, 9) + "-" + DateTo.ToString().Substring(0, 9));

        c.addTitle(title, "Tahoma Bold", 12);
        c.setPlotArea(70, 80, 640, 230, c.gradientColor(0, 60, 0, 350, 16777215, 11189196), -1, Chart.Transparent, 1111);
        c.addLegend(30, 25, false, "Tahoma Bold", 8).setBackground(Chart.Transparent); c.xAxis().setLabels(labels);
        c.yAxis().setTickDensity(30);
        c.xAxis().setLabelStyle("Tahoma", 8, 001122, 90);
        c.yAxis().setLabelStyle("Tahoma", 8);
        c.yAxis().setLabelFormat("{value|0,}");
        c.xAxis().setWidth(2);
        c.yAxis().setWidth(2);
        c.yAxis().setTitle("¨Ó¹Ç¹ÊÔ¹¤éÒ/Çѵ¶Ø´Ôº", "Tahoma Bold", 10);
        c.xAxis().setTitle("Çѹ·Õè", "Tahoma Bold", 10);

        c.xAxis().setLabels(labels);


        LineLayer layer = c.addLineLayer();
        layer.setLineWidth(1);
        AddDateData(layer, DateFrom, DateTo, BarcodeFrom, BarcodeTo);
        vwChart.Image = c.makeWebImage(Chart.PNG);
        vwChart.ImageMap = c.getHTMLImageMap("", "",
            "title='{dataSetName} ã¹Çѹ·Õè {xLabel}\r\n{value|,} ÃÒ¡Òà ({percent}%)'");
    }
示例#39
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...
            {

            }
        }
示例#40
0
		private void buildBarChart() {

			int topMargin = 30;
			int bottomnMargin = 70;
			int leftMargin = 50;
			int rightMargin = 30; 
			
			BarChartData data = (BarChartData)this.chartData;
			this.Text = data.Title;
			XYChart barChart = new XYChart(this.chartPanel.Size.Width, this.chartPanel.Size.Height, 0xeeeeff, -1, 2);

            barChart.setPlotArea(leftMargin, topMargin, this.chartPanel.Size.Width - (leftMargin + rightMargin),
                this.chartPanel.Size.Height - (topMargin + bottomnMargin), 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
			
			barChart.addTitle(data.Title);
			// Set the labels on the x axis.
			barChart.xAxis().setLabels(data.Labels);

			ChartDirector.BarLayer layer = barChart.addBarLayer3(data.Data, data.Colors, data.Labels);
			layer.setBorderColor(-1, 1);
			layer.set3D();

			// output the chart
			this.chartPanel.Image = barChart.makeImage();
		}
示例#41
0
    private void SetYearlyGraph()
    {
        int yearFrom = Convert.ToInt32((txtYearFrom.Text.Trim() == "" ? "0" : txtYearFrom.Text.Trim())) - 543;
        int yearTo = Convert.ToInt32((txtYearTo.Text.Trim() == "" ? "0" : txtYearTo.Text.Trim())) - 543;
        if (yearFrom < 0)
            yearFrom = 0;
        if (yearTo < 0)
            yearTo = 0;
        int tmp = yearFrom;
        if (yearFrom > yearTo)
        {
            yearFrom = yearTo;
            yearTo = tmp;
        }
        yearFrom += 543;
        yearTo += 543;

        string[] labels = { "�.�.", "�.�.", "��.�.", "��.�.", "�.�.", "��.�.", "�.�.", "�.�.", "�.�.", "�.�.", "�.�.", "�.�." };

        XYChart c = new XYChart(750, 380, 15663086, 14540253, 0);
        string title = GetTitle() + (yearFrom == yearTo ? "㹻� �.�. " + yearFrom.ToString() : " ������ �.�. " + yearFrom.ToString() + "-" + yearTo.ToString());
        c.addTitle(title, "Tahoma Bold", 12);

        c.setPlotArea(70, 80, 640, 230, c.gradientColor(0, 60, 0, 350, 16777215, 11189196), -1, Chart.Transparent, 1111);

        c.addLegend(30, 25, false, "Tahoma Bold", 8).setBackground(Chart.Transparent);
        c.xAxis().setLabels(labels);
        c.yAxis().setTickDensity(30);
        c.xAxis().setLabelStyle("Tahoma", 8, 001122, 90);
        c.yAxis().setLabelStyle("Tahoma", 8);
        c.yAxis().setLabelFormat("{value|0,}");
        c.xAxis().setWidth(2);
        c.yAxis().setWidth(2);
        c.yAxis().setTitle("�ӹǹ", "Tahoma Bold", 10);
        c.xAxis().setTitle("��͹", "Tahoma Bold", 10);

        LineLayer layer = c.addLineLayer();
        layer.setLineWidth(1);
        AddData(layer, yearFrom - 543, yearTo - 543);
        vwChart.Image = c.makeWebImage(Chart.PNG);
    }
示例#42
0
        private void UpdatePlot(object sender, RunWorkerCompletedEventArgs e)
        {
            List<object> objlist = new List<object>();
            objlist.AddRange((List<object>)e.Result);
            double[] depart = (double[])objlist[0];
            double[] arrive = (double[])objlist[1];
            double[] departVel = (double[])objlist[2];
            string Plan1Name = (string)objlist[3];
            string Plan2Name = (string)objlist[4];

            XYChart c = new XYChart(800, 800);
            c.setPlotArea(75, 40, 600, 600, -1, -1, -1, c.dashLineColor(unchecked((int)0x80000000), Chart.DotLine), -1);
            // When auto-scaling, use tick spacing of 40 pixels as a guideline
            c.yAxis().setTickDensity(40);
            c.xAxis().setTickDensity(40);


            // Add a contour layer using the given data
            ContourLayer layer = c.addContourLayer(depart, arrive, departVel);
            c.getPlotArea().moveGridBefore(layer);
            ColorAxis cAxis = layer.setColorAxis(700, 40, Chart.TopLeft, 400, Chart.Right);
            double[] colorScale = { 3, 0x090446, 3.3, 0x16366B, 3.6, 0x236890, 3.9, 0x309AB5, 4.2, 0x53C45A, 4.5, 0x77EF00, 4.8, 0xBBF70F, 5.1, 0xFFFF1E, 5.4, 0xFF8111, 5.7, 0xFF0404 };
            cAxis.setColorScale(colorScale, 0x090446, 0xffffff);
            cAxis.setColorGradient(false);
            // Add a title to the color axis using 12 points Arial Bold Italic font
            cAxis.setTitle("Departure Velocity (km/s)", "Arial Bold Italic", 12);
            c.xAxis().setTitle("Departure Date (JDCT)");
            c.yAxis().setTitle("Arrival Date (JDCT)");
            c.addTitle("Departure Velocity from " + Plan1Name + " to " + Plan2Name);
            c.xAxis().setTickLength(10);
            c.yAxis().setTickLength(10);


            // Output the chart
            winChartViewer1.Chart = c;
            winChartViewer1.ImageMap = c.getHTMLImageMap("");
            /*
                        // 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" };

            XYChart c = new XYChart(250, 250);
            c.setPlotArea(30, 20, 200, 200);
            c.addBarLayer(data);
            c.xAxis().setLabels(labels);
            winChartViewer1.Chart = c;
            */

        }
示例#43
0
    private void SetMonthlyProductGraph()
    {
        int yearFrom = Convert.ToInt32(Request["yearfrom"]);
        int yearTo = Convert.ToInt32(Request["yearto"]);
        int currentYear = Convert.ToInt32(Request["currentyear"]);
        //int yearFrom = 2551;
        //int yearTo = 2551;
        //int currentYear = 2551;
        this.lnkYear.Text = GetReportTitle() + (yearFrom == yearTo ? "ã¹»Õ ¾.È. " + yearFrom.ToString() : " µÑé§áµè»Õ ¾.È. " + yearFrom.ToString() + "-" + yearTo.ToString());
        this.lblMonth.Text = ">> »Õ ¾.È. " + currentYear.ToString();
        this.pnlMonth.Visible = true;
        string[] labels = { "Á.¤.", "¡.¾.", "ÁÕ.¤.", "àÁ.Â.", "¾.¤.", "ÁÔ.Â.", "¡.¤.", "Ê.¤.", "¡.Â.", "µ.¤.", "¾.Â.", "¸.¤." };
        XYChart c = new XYChart(750, 380, 15663086, 14540253, 0);
        string title = GetReportTitle() + "ã¹»Õ ¾.È. " + currentYear.ToString();

        c.addTitle(title, "Tahoma Bold", 12);
        c.setPlotArea(70, 80, 640, 230, c.gradientColor(0, 60, 0, 350, 16777215, 11189196), -1, Chart.Transparent, 1111);
        c.addLegend(30, 25, false, "Tahoma Bold", 8).setBackground(Chart.Transparent); 
        c.xAxis().setLabels(labels);
        c.yAxis().setTickDensity(30);
        c.xAxis().setLabelStyle("Tahoma", 8, 001122, 90);
        c.yAxis().setLabelStyle("Tahoma", 8);
        c.yAxis().setLabelFormat("{value|0,}");
        c.xAxis().setWidth(2);
        c.yAxis().setWidth(2);
        c.yAxis().setTitle("ÃÒ¤Ò", "Tahoma Bold", 10);
        c.xAxis().setTitle("à´×͹", "Tahoma Bold", 10);

        LineLayer layer = c.addLineLayer();
        layer.setLineWidth(1);
        AddData(layer, currentYear - 543);
        vwChart.Image = c.makeWebImage(Chart.PNG);
        vwChart.ImageMap = c.getHTMLImageMap("", "", "title='{dataSetName} ã¹à´×͹ {xLabel}\r\n{value|,} ÃÒ¡Òà ({percent}%)'");
        this.pnlChart.Visible = true;
    }