Page 1 of 1

A Simple Pie Chart Example

Posted: Fri Mar 18, 2005 9:24 am
by 6923391
I'm having real troubles finding chart examples for web charts (ASP.net).

Could you please show me a quick example of how to make a pie chart when I have only two values; 45% and 55%. Preferably in VB.net, but C# is no problem.

I also want those sticky little signs showing "45%" and "55%" respectively.

Thank you,
Mathias

Posted: Fri Mar 18, 2005 10:02 am
by narcis
Hi Mathias,
I'm having real troubles finding chart examples for web charts (ASP.net).
You should fine live ASP.NET examples included with your TeeChart installation. The examples can be found at the TeeChart program group.
Could you please show me a quick example of how to make a pie chart when I have only two values; 45% and 55%. Preferably in VB.net, but C# is no problem.

I also want those sticky little signs showing "45%" and "55%" respectively.
Yes, you can add a pie series in the WebChart at design-time and then do something like:

Code: Select all

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        With WebChart1.Chart.Series(0)
            .Add(45)
            .Add(55)
            With .Marks
                .Visible = True
                .Style = Steema.TeeChart.Styles.MarksStyles.Percent
            End With
        End With
    End Sub

Posted: Fri Mar 18, 2005 10:26 am
by 6923391
narcis wrote:
I'm having real troubles finding chart examples for web charts (ASP.net).
You should fine live ASP.NET examples included with your TeeChart installation. The examples can be found at the TeeChart program group.
Well, I can't find any there. The Feature demo doesn't contain ASP.net examples. If I choose the TeeChart for .Net Examples application and choose the Web tab, I only see this message:
All information about TeeChart Pro at www.teeChart.net

TeeChart for .NET Help only contains the class library.

Posted: Fri Mar 18, 2005 11:37 am
by narcis
Hi Mathias,

Those examples are under the "ASP Server examples" shortcut which points to "C:\Program Files\Steema Software\TeeChart for .NET v1\TeeChartForNET\DemoHome.htm" (default english installation path).

Posted: Fri Mar 18, 2005 12:55 pm
by 6923391
But that is only an example with three graphs, and no pie chart. :(

Posted: Mon Mar 21, 2005 7:34 am
by Chris
Hi Mathias,

Code: Select all

Could you please show me a quick example of how to make a pie chart when I have only two values; 45% and 55%. Preferably in VB.net, but C# is no problem. 
We can modify the example you have already discovered to show the sort of pie series you wish to display.

In the Page_Load event of WebForm1.aspx, please remove all references to ch2 and then add in the following code:

Code: Select all

Steema.TeeChart.Chart ch2=WebChart2.Chart;
if (ch2.Series.Count<2)
{
ch2.Series.Add(new Steema.TeeChart.Styles.Pie());
}
ch2.Header.Font.Color=Color.Yellow;
ch2.Header.Text="Chart 2: Pie demo";
ch2.Legend.Visible=false;
ch2.Series[0].Add(45, "45%");
ch2.Series[0].Add(55, "55%");

Posted: Tue Mar 22, 2005 9:14 am
by 6923391
Thank you Chris, but VB is the preferred language. However, I'm having trouble finding simple examples in ASP.net. This time I needed a simple pie chart diagram and when you are new to the TeeChart component, it's hard to find your way to a good result. But the next time, another type is needed and there are few examples.

Mathias
MMP

Posted: Tue Mar 22, 2005 9:39 am
by narcis
HI Mathias,

You can use one of the site tools available in internat for converting C# code to VB.