SasqChart
Home
Home
Chart Gallery
Thumbs
Bar Charts
Stacked Bar
Line Charts
Area Charts
Stacked Area
Pie Charts
Mixed Charts
Chart Styles
Axis Options
Layout Options
ASP.Net Tutorials
Base Example
DataSet Bind
WinForm Tutorials
Base Example
DataSet Bind
  Forums Login
Username:
Password:
 
Create account
Forget password?
 Who is Online

There are currently:
2 anonymous users online.

0 of 572 registered users online.

There have been 110871 Page Hits by 85043 users

 Search Forums

More search options


Pie chart with single exploded section

C# Example Code

{
    int width = (int)chart.Width.Value;        // Hack. Assuming type = Pixel
    int height = (int)chart.Height.Value;        // Hack. Assuming type = Pixel

    string []lables = {"Nuts", "Bolts", "Screws", "Washers", "Nails"};

    System.Random r= new System.Random();
    chart.Series[0].Type = ChartType.Pie;
    chart.Theme = Theme.Blues;
    chart.Shadow.Visible = true;
    chart.Legend.Visible = true;
    chart.Legend.Position = Position.BottomLeft;
    chart.Legend.Style.Font = new Font(FontFamily.GenericSansSerif, 8);
    chart.Legend.Style.FillColor = Color.FromArgb(0x80, Color.LightGray);
    chart.DataPointsUseSeriesColors = true;

    // Show data labels
    chart.ShowDataLabel = true;

    for (int i=0;i<5;i++)
    {
        chart.Series[0].Data.Add(new DataPoint(10.0 + r.NextDouble()* 20, lables[i]));
    }
    chart.Series[0].Data[0].Value2 = 0.4;    //40% Explosion
}

ASP.Net C# Example

<%@ Register tagPrefix="SasqChart" Namespace="SasqChart" Assembly="SasqChart" %>
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<HTML>
    <HEAD>
        <title>Simple C# SasqChart Example</title>
        <script runat="server">
            private void Page_Load(object sender, System.EventArgs e)		
            {
                int width = (int)chart.Width.Value;        // Hack. Assuming type = Pixel
                int height = (int)chart.Height.Value;        // Hack. Assuming type = Pixel
            
                string []lables = {"Nuts", "Bolts", "Screws", "Washers", "Nails"};
            
                System.Random r= new System.Random();
                chart.Series[0].Type = ChartType.Pie;
                chart.Theme = Theme.Blues;
                chart.Shadow.Visible = true;
                chart.Legend.Visible = true;
                chart.Legend.Position = Position.BottomLeft;
                chart.Legend.Style.Font = new Font(FontFamily.GenericSansSerif, 8);
                chart.Legend.Style.FillColor = Color.FromArgb(0x80, Color.LightGray);
                chart.DataPointsUseSeriesColors = true;
            
                // Show data labels
                chart.ShowDataLabel = true;
            
                for (int i=0;i<5;i++)
                {
                    chart.Series[0].Data.Add(new DataPoint(10.0 + r.NextDouble()* 20, lables[i]));
                }
                chart.Series[0].Data[0].Value2 = 0.4;    //40% Explosion
            }

        </script>
    </HEAD>
    <body>
        <SasqChart:WebChartControl id="chart" runat="server" width="600" height="400" />
    </body>
</HTML>