//Main code for creating chart.
        //Note: the argument img is unused because this demo only has 1 chart.
        public void createChart(WinChartViewer viewer, string img)
        {
            // The data for the pyramid chart
            double[] data = { 156, 123, 211, 179 };

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

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

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

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

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

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

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

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

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

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

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

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{label}: US$ {value}M ({percent}%)'");
        }
Example #2
0
        //
        // Create chart
        //
        private void createChart(RazorChartViewer viewer)
        {
            // In this example, the data points are unevenly spaced on the x-axis
            double[]   dataY = { 4.7, 4.7, 6.6, 2.2, 4.7, 4.0, 4.0, 5.1, 4.5, 4.5, 6.8, 4.5, 4, 2.1, 3, 2.5,
                                 2.5, 3.1 };
            DateTime[] dataX = { new DateTime(1999,                                                                   7,  1), new DateTime(2000,                 1,  1), new DateTime(2000,                 2,
                                                                                                                                                                                      1), new DateTime(2000,   4,                1), new DateTime(2000,   5,                8), new DateTime(2000,  7, 5),
                                 new DateTime(2001,                                                                   3,  5), new DateTime(2001,                 4,  7), new DateTime(2001,                 5, 9),
                                 new DateTime(2002,                                                                   2,  4), new DateTime(2002,                 4,  4), new DateTime(2002,                 5, 8),
                                 new DateTime(2002,                                                                   7,  7), new DateTime(2002,                 8, 30), new DateTime(2003,                 1, 2),
                                 new DateTime(2003,                                                                   2, 16), new DateTime(2003,                11,  6), new DateTime(2004,                 1, 4) };

            // Data points are assigned different symbols based on point type
            double[] pointType = { 0, 1, 0, 1, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 2, 1, 2, 0 };

            // Create a XYChart object of size 480 x 320 pixels. Use a vertical gradient color from pale
            // blue (e8f0f8) to sky blue (aaccff) spanning half the chart height as background. Set
            // border to blue (88aaee). Use rounded corners. Enable soft drop shadow.
            XYChart c = new XYChart(480, 320);

            c.setBackground(c.linearGradientColor(0, 0, 0, c.getHeight() / 2, 0xe8f0f8, 0xaaccff),
                            0x88aaee);
            c.setRoundedFrame();
            c.setDropShadow();

            // Add a title to the chart using 15 points Arial Italic font. Set top/bottom margins to 12
            // pixels.
            ChartDirector.TextBox title = c.addTitle("Multi-Symbol Line Chart Demo", "Arial Italic", 15);
            title.setMargin2(0, 0, 12, 12);

            // Tentatively set the plotarea to 50 pixels from the left edge to allow for the y-axis, and
            // to just under the title. Set the width to 65 pixels less than the chart width, and the
            // height to reserve 90 pixels at the bottom for the x-axis and the legend box. Use pale blue
            // (e8f0f8) background, transparent border, and grey (888888) dotted horizontal and vertical
            // grid lines.
            c.setPlotArea(50, title.getHeight(), c.getWidth() - 65, c.getHeight() - title.getHeight() -
                          90, 0xe8f0f8, -1, Chart.Transparent, c.dashLineColor(0x888888, Chart.DotLine), -1);

            // Add a legend box where the bottom-center is anchored to the 12 pixels above the
            // bottom-center of the chart. Use horizontal layout and 8 points Arial font.
            LegendBox legendBox = c.addLegend(c.getWidth() / 2, c.getHeight() - 12, false, "Arial Bold",
                                              8);

            legendBox.setAlignment(Chart.BottomCenter);

            // Set the legend box background and border to pale blue (e8f0f8) and bluish grey (445566)
            legendBox.setBackground(0xe8f0f8, 0x445566);

            // Use rounded corners of 5 pixel radius for the legend box
            legendBox.setRoundedCorners(5);

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

            // Set y-axis title to use 10 points Arial Bold Italic font
            c.yAxis().setTitle("Axis Title Placeholder", "Arial Bold Italic", 10);

            // Set axis labels to use Arial Bold font
            c.yAxis().setLabelStyle("Arial Bold");
            c.xAxis().setLabelStyle("Arial Bold");

            // We add the different data symbols using scatter layers. The scatter layers are added
            // before the line layer to make sure the data symbols stay on top of the line layer.

            // We select the points with pointType = 0 (the non-selected points will be set to NoValue),
            // and use yellow (ffff00) 15 pixels high 5 pointed star shape symbols for the points. (This
            // example uses both x and y coordinates. For charts that have no x explicitly coordinates,
            // use an empty array as dataX.)
            c.addScatterLayer(Chart.CTime(dataX), new ArrayMath(dataY).selectEQZ(pointType, Chart.NoValue
                                                                                 ).result(), "Point Type 0", Chart.StarShape(5), 15, 0xffff00);

            // Similar to above, we select the points with pointType - 1 = 0 and use green (ff00) 13
            // pixels high six-sided polygon as symbols.
            c.addScatterLayer(Chart.CTime(dataX), new ArrayMath(dataY).selectEQZ(new ArrayMath(pointType
                                                                                               ).sub(1).result(), Chart.NoValue).result(), "Point Type 1", Chart.PolygonShape(6), 13,
                              0x00ff00);

            // Similar to above, we select the points with pointType - 2 = 0 and use red (ff0000) 13
            // pixels high X shape as symbols.
            c.addScatterLayer(Chart.CTime(dataX), new ArrayMath(dataY).selectEQZ(new ArrayMath(pointType
                                                                                               ).sub(2).result(), Chart.NoValue).result(), "Point Type 2", Chart.Cross2Shape(), 13,
                              0xff0000);

            // Finally, add a blue (0000ff) line layer with line width of 2 pixels
            LineLayer layer = c.addLineLayer(dataY, 0x0000ff);

            layer.setXData(Chart.CTime(dataX));
            layer.setLineWidth(2);

            // Adjust the plot area size, such that the bounding box (inclusive of axes) is 10 pixels
            // from the left edge, just below the title, 25 pixels from the right edge, and 8 pixels
            // above the legend box.
            c.packPlotArea(10, title.getHeight(), c.getWidth() - 25, c.layoutLegend().getTopY() - 8);

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

            // Include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("", "", "title='{x|mmm dd, yyyy}: {value}%'");
        }
Example #3
0
        //Main code for creating chart.
        //Note: the argument img is unused because this demo only has 1 chart.
        public void createChart(WinChartViewer viewer, string img)
        {
            // The data for the pie chart
            double[] data = { 25, 18, 15, 12, 8, 30, 35 };

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

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

            c.setRoundedFrame(0xffffff, 20);

            // Add a title using 18 pts Times New Roman Bold Italic font. #Set
            // top/bottom margins to 8 pixels.
            ChartDirector.TextBox title = c.addTitle("Donut Chart Demonstration",
                                                     "Times New Roman Bold Italic", 18);
            title.setMargin2(0, 0, 8, 8);

            // Add a 2 pixels wide separator line just under the title
            c.addLine(10, title.getHeight(), c.getWidth() - 11, title.getHeight(),
                      Chart.LineColor, 2);

            // Set donut center at (160, 175), and outer/inner radii as 110/55 pixels
            c.setDonutSize(160, 175, 110, 55);

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

            // Use ring shading effect for the sectors
            c.setSectorStyle(Chart.RingShading);

            // Use the side label layout method, with the labels positioned 16 pixels
            // from the donut bounding box
            c.setLabelLayout(Chart.SideLayout, 16);

            // Show only the sector number as the sector label
            c.setLabelFormat("{={sector}+1}");

            // Set the sector label style to Arial Bold 10pt, with a dark grey
            // (444444) border
            c.setLabelStyle("Arial Bold", 10).setBackground(Chart.Transparent,
                                                            0x444444);

            // Add a legend box, with the center of the left side anchored at (330,
            // 175), and using 10 pts Arial Bold Italic font
            LegendBox b = c.addLegend(330, 175, true, "Arial Bold Italic", 10);

            b.setAlignment(Chart.Left);

            // Set the legend box border to dark grey (444444), and with rounded
            // conerns
            b.setBackground(Chart.Transparent, 0x444444);
            b.setRoundedCorners();

            // Set the legend box margin to 16 pixels, and the extra line spacing
            // between the legend entries as 5 pixels
            b.setMargin(16);
            b.setKeySpacing(0, 5);

            // Set the legend text to show the sector number, followed by a 120
            // pixels wide block showing the sector label, and a 40 pixels wide block
            // showing the percentage
            b.setText(
                "<*block,valign=top*>{={sector}+1}.<*advanceTo=22*>" +
                "<*block,width=120*>{label}<*/*><*block,width=40,halign=right*>" +
                "{percent}<*/*>%");

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

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{label}: US${value}K ({percent}%)'");
        }
        //Main code for creating chart.
        //Note: the argument chartIndex is unused because this demo only has 1 chart.
        public void createChart(WPFChartViewer viewer, int chartIndex)
        {
            // The x coordinates for the 2 scatter groups
            DateTime[] dataX = { new DateTime(2011,                                                                                       9,  1), new DateTime(2011,                 9, 2), new DateTime(
                                     2011,                                                                                                9,  3), new DateTime(2011,                 9, 4), new DateTime(2011,  9,5), new DateTime(2011,
                                                                                                                                                                                                                  9,                    6), new DateTime(2011,   9,                7), new DateTime(2011,9,                8),new DateTime(2011,9, 9),
                                 new DateTime(2011,                                                                                       9, 10), new DateTime(2011,                 9, 11) };

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            // Output the chart
            viewer.Chart = c;
        }
        public void createChart(WinChartViewer viewer, DataTable dt_chart, string title)
        {
            try
            {
                Chart.setLicenseCode("DEVP-2LSU-B4LX-YCTY-2DF2-77EE");

                double[] data   = new double[dt_chart.Rows.Count];
                string[] labels = new string[dt_chart.Rows.Count];

                for (int i = 0; i < dt_chart.Rows.Count; i++)
                {
                    data[i]   = Convert.ToDouble(dt_chart.Rows[i]["RATE"].ToString());
                    labels[i] = dt_chart.Rows[i]["reason_tail_nm"].ToString();
                }



                // The colors to use for the sectors
                int[] colors = { 0x66aaee, 0xeebb22, 0xbbbbbb, 0x8844ff, 0xdd2222,
                                 0x009900, 0xff8040, 0xaa0023 };

                // Create a PieChart object of size 600 x 320 pixels. Use a vertical
                // gradient color from light blue (99ccff) to white (ffffff) spanning the
                // top 100 pixels as background. Set border to grey (888888). Use rounded
                // corners. Enable soft drop shadow.
                PieChart c = new PieChart(690, 310);
                c.setBackground(c.linearGradientColor(0, 0, 0, 100, 0x99ccff, 0xffffff),
                                0x888888);
                c.setRoundedFrame();
                c.setDropShadow();

                // Add a title using 18 pts Times New Roman Bold Italic font. Add 16
                // pixels top margin to the title.
                c.addTitle(title,
                           "Times New Roman Bold Italic", 18).setMargin2(0, 0, 1, 0);

                // Set the center of the pie at (160, 165) and the radius to 110 pixels
                c.setPieSize(230, 170, 140);

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

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

                // Set the sector colors
                c.setColors2(Chart.DataColor, colors);

                // Use local gradient shading for the sectors
                c.setSectorStyle(Chart.LocalGradientShading);

                // Use the side label layout method, with the labels positioned 16 pixels
                // from the pie bounding box
                c.setLabelLayout(Chart.Transparent, 16);

                // Show only the sector number as the sector label
                c.setLabelFormat("{percent} % ");

                // Set the sector label style to Arial Bold 10pt, with a dark grey
                // (444444) border
                c.setLabelStyle("Arial Bold", 10).setBackground(Chart.Transparent,
                                                                0x444444);

                // Add a legend box, with the center of the left side anchored at (330,
                // 175), and using 10 pts Arial Bold Italic font
                LegendBox b = new LegendBox();
                b = c.addLegend(470, 150, true, "Arial Bold Italic", 12);
                b.setAlignment(Chart.Left);

                // Set the legend box border to dark grey (444444), and with rounded
                // conerns
                b.setBackground(Chart.Transparent, 0x444444);
                b.setRoundedCorners();

                // Set the legend box margin to 16 pixels, and the extra line spacing
                // between the legend entries as 5 pixels
                b.setMargin(16);
                b.setKeySpacing(0, 5);

                // Set the legend box icon to have no border (border color same as fill
                // color)
                b.setKeyBorder(Chart.SameAsMainColor);

                // Set the legend text to show the sector number, followed by a 120
                // pixels wide block showing the sector label, and a 40 pixels wide block
                // showing the percentage
                b.setText(
                    "<*block,valign=top*> <*advanceTo=22*>" +
                    "<*block,width=140*>{label}<*/*>");

                // Output the chart
                viewer.Chart = c;

                //include tool tip for the chart
                viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                    "title='{label}: {percent} % '");
            }
            catch
            {
            }
            // The data for the pie chart
            //dt_chart = this.select_chart_1();
        }
Example #6
0
        //Main code for creating chart.
        //Note: the argument chartIndex is unused because this demo only has 1 chart.
        public void createChart(WinChartViewer viewer, int chartIndex)
        {
            // The data for the bars and the marks
            double[] barData  = { 100, 125, 245, 147, 67, 96, 160, 145, 97, 167, 220, 125 };
            double[] markData = { 85, 156, 220, 120, 80, 110, 140, 130, 111, 180, 175, 100 };

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

            // Create a XYChart object of size 480 x 360 pixels. Use a vertical gradient color from
            // pale blue (e8f0f8) to sky blue (aaccff) spanning half the chart height as background.
            // Set border to blue (88aaee). Use rounded corners. Enable soft drop shadow.
            XYChart c = new XYChart(480, 360);

            c.setBackground(c.linearGradientColor(0, 0, 0, c.getHeight() / 2, 0xe8f0f8, 0xaaccff),
                            0x88aaee);
            c.setRoundedFrame();
            c.setDropShadow();

            // Add a title to the chart using 15 points Arial Italic font. Set top/bottom margins to
            // 12 pixels.
            ChartDirector.TextBox title = c.addTitle("Bars with Marks Demonstration",
                                                     "Arial Italic", 15);
            title.setMargin2(0, 0, 12, 12);

            // Tentatively set the plotarea to 50 pixels from the left edge to allow for the y-axis,
            // and to just under the title. Set the width to 65 pixels less than the chart width,
            // and the height to reserve 90 pixels at the bottom for the x-axis and the legend box.
            // Use pale blue (e8f0f8) background, transparent border, and grey (888888) dotted
            // horizontal grid lines.
            c.setPlotArea(50, title.getHeight(), c.getWidth() - 65, c.getHeight() - title.getHeight(
                              ) - 90, 0xe8f0f8, -1, Chart.Transparent, c.dashLineColor(0x888888, Chart.DotLine));

            // Add a legend box where the bottom-center is anchored to the 15 pixels above the
            // bottom-center of the chart. Use horizontal layout and 8 points Arial font.
            LegendBox legendBox = c.addLegend(c.getWidth() / 2, c.getHeight() - 15, false, "Arial",
                                              8);

            legendBox.setAlignment(Chart.BottomCenter);

            // Set the legend box background and border to pale blue (e8f0f8) and bluish grey
            // (445566)
            legendBox.setBackground(0xe8f0f8, 0x445566);

            // Use rounded corners of 5 pixel radius for the legend box
            legendBox.setRoundedCorners(5);

            // Use line style legend key
            legendBox.setLineStyleKey();

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

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

            // Add a box-whisker layer with just the middle mark visible for the marks. Use red
            // (ff0000) color for the mark, with a line width of 2 pixels and 10% horizontal gap
            BoxWhiskerLayer markLayer = c.addBoxWhiskerLayer(null, null, null, null, markData, -1,
                                                             0xff0000);

            markLayer.setLineWidth(2);
            markLayer.setDataGap(0.1);

            // Add the legend key for the mark line
            legendBox.addKey("Target", 0xff0000, 2);

            // Tool tip for the mark layer
            markLayer.setHTMLImageMap("", "", "title='Target at {xLabel}: {med}'");

            // Add a blue (0066cc) bar layer using the given data.
            BarLayer barLayer = c.addBarLayer(barData, 0x0066cc, "Actual");

            // Use soft lighting effect for the bars with light direction from left.
            barLayer.setBorderColor(Chart.Transparent, Chart.softLighting(Chart.Left));

            // Tool tip for the bar layer
            barLayer.setHTMLImageMap("", "", "title='{dataSetName} at {xLabel}: {value}'");

            // Adjust the plot area size, such that the bounding box (inclusive of axes) is 10
            // pixels from the left edge, just below the title, 15 pixels from the right edge, and
            // 10 pixels above the legend box.
            c.packPlotArea(10, title.getHeight(), c.getWidth() - 15, c.layoutLegend().getTopY() - 10
                           );

            // Output the chart
            viewer.Chart = c;

            // Include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable");
        }
        //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 pie chart
            double[] data = { 21, 18, 15, 12, 8, 24 };

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

            // The colors to use for the sectors
            int[] colors = { 0x66aaee, 0xeebb22, 0xbbbbbb, 0x8844ff, 0xdd2222, 0x009900 };

            // Create a PieChart object of size 600 x 320 pixels. Use a vertical gradient color from
            // light blue (99ccff) to white (ffffff) spanning the top 100 pixels as background. Set
            // border to grey (888888). Use rounded corners. Enable soft drop shadow.
            PieChart c = new PieChart(600, 320);

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

            // Add a title using 18pt Times New Roman Bold Italic font. Add 16 pixels top margin to
            // the title.
            c.addTitle("Pie Chart With Legend Demonstration", "Times New Roman Bold Italic", 18
                       ).setMargin2(0, 0, 16, 0);

            // Set the center of the pie at (160, 165) and the radius to 110 pixels
            c.setPieSize(160, 165, 110);

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

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

            // Set the sector colors
            c.setColors2(Chart.DataColor, colors);

            // Use local gradient shading for the sectors
            c.setSectorStyle(Chart.LocalGradientShading);

            // Use the side label layout method, with the labels positioned 16 pixels from the pie
            // bounding box
            c.setLabelLayout(Chart.SideLayout, 16);

            // Show only the sector number as the sector label
            c.setLabelFormat("{={sector}+1}");

            // Set the sector label style to Arial Bold 10pt, with a dark grey (444444) border
            c.setLabelStyle("Arial Bold", 10).setBackground(Chart.Transparent, 0x444444);

            // Add a legend box, with the center of the left side anchored at (330, 175), and using
            // 10pt Arial Bold Italic font
            LegendBox b = c.addLegend(330, 175, true, "Arial Bold Italic", 10);

            b.setAlignment(Chart.Left);

            // Set the legend box border to dark grey (444444), and with rounded conerns
            b.setBackground(Chart.Transparent, 0x444444);
            b.setRoundedCorners();

            // Set the legend box margin to 16 pixels, and the extra line spacing between the legend
            // entries as 5 pixels
            b.setMargin(16);
            b.setKeySpacing(0, 5);

            // Set the legend box icon to have no border (border color same as fill color)
            b.setKeyBorder(Chart.SameAsMainColor);

            // Set the legend text to show the sector number, followed by a 120 pixels wide block
            // showing the sector label, and a 40 pixels wide block showing the percentage
            b.setText(
                "<*block,valign=top*>{={sector}+1}.<*advanceTo=22*><*block,width=120*>{label}" +
                "<*/*><*block,width=40,halign=right*>{percent}<*/*>%");

            // Output the chart
            viewer.Chart = c;

            //include tool tip for the chart
            viewer.ImageMap = c.getHTMLImageMap("clickable", "",
                                                "title='{label}: US${value}K ({percent}%)'");
        }