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:
4 anonymous users online.

0 of 204 registered users online.

There have been 10429 Page Hits by 7977 users

 Search Forums

More search options


Custom Area Chart Example

C# Example Code

{            
    int width = (int)chart.Width.Value;        // Hack. Assuming type = Pixel
    int height = (int)chart.Height.Value;        // Hack. Assuming type = Pixel
    
    System.Random r= new System.Random();
    chart.Theme = Theme.Greens;
    chart.Series[0].Name = "Food";
    chart.Series[1].Name = "Hunger";
    chart.Series[0].Type = ChartType.SmoothArea;
    chart.Series[1].Type = ChartType.SmoothLine;
    
    // Setup the Header
    chart.Header.CustomRectangle = new Rectangle(80, 30, 200, 40);
    chart.Header.Text = "Food vs Hunger";
    chart.Header.Style.Font = new Font(FontFamily.GenericSansSerif, 15);
    
    // Position the legend
    chart.Legend.Visible = true;
    chart.Legend.CustomRectangle = new Rectangle(width-120, height-110, 100, 60);
        
    // Hide far Y axis
    chart.SecondaryYAxis.Visible = false;

    for (int i=0; i<=5; i++)
    {
        chart.Series[0].Data.Add(new DataPoint(4 + r.NextDouble()* i, i.ToString()));
        chart.Series[1].Data.Add(new DataPoint(4 + r.NextDouble()* i, i.ToString()));
    }                    
}

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
                
                System.Random r= new System.Random();
                chart.Theme = Theme.Greens;
                chart.Series[0].Name = "Food";
                chart.Series[1].Name = "Hunger";
                chart.Series[0].Type = ChartType.SmoothArea;
                chart.Series[1].Type = ChartType.SmoothLine;
                
                // Setup the Header
                chart.Header.CustomRectangle = new Rectangle(80, 30, 200, 40);
                chart.Header.Text = "Food vs Hunger";
                chart.Header.Style.Font = new Font(FontFamily.GenericSansSerif, 15);
                
                // Position the legend
                chart.Legend.Visible = true;
                chart.Legend.CustomRectangle = new Rectangle(width-120, height-110, 100, 60);
                    
                // Hide far Y axis
                chart.SecondaryYAxis.Visible = false;
            
                for (int i=0; i<=5; i++)
                {
                    chart.Series[0].Data.Add(new DataPoint(4 + r.NextDouble()* i, i.ToString()));
                    chart.Series[1].Data.Add(new DataPoint(4 + r.NextDouble()* i, i.ToString()));
                }                    
            }

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