Customising Legend Text on a WebChart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
phil1995
Newbie
Newbie
Posts: 31
Joined: Fri Dec 16, 2005 12:00 am
Location: Hattiesburg, Ms.
Contact:

Customising Legend Text on a WebChart

Post by phil1995 » Fri Oct 08, 2010 3:57 pm

I have been searching for hours and can not figure out how to customize the text in a legend on a Webchart. All of the code that I see written here, is not available to me. Can someone please tell me how to customize the text in a legend on a webchart. I have just updated to TeeChartNET2UpdateBuild.exe



<tchart:WebChart ID="WebChart9" runat="server" AutoPostback="False" Config="AAEAAAD//...
GetChartFile="GetChart.aspx" Height="450px" TempChart="Session" Width="750px" />

Public Pie9 As Steema.TeeChart.Styles.Pie = New Steema.TeeChart.Styles.Pie

Pie9.Add(MyStkCount, color:=Drawing.Color.Blue)
Pie9.Add(MyInStkCount, color:=Drawing.Color.Green)
Pie9.Marks.Style = Steema.TeeChart.Styles.MarksStyles.PercentTotal
Pie9.Marks.Visible = True
WebChart9.Chart.Series.Add(Pie9)

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Customising Legend Text on a WebChart

Post by Sandra » Mon Oct 11, 2010 8:09 am

Hello phil1995,

If you would customize text in your legend, you need use GetLegendText Event that allow you change text of legend as do in next example:

Code: Select all

 protected void Page_Load(object sender, EventArgs e)
    {
        InitializeChart();
    }
    Steema.TeeChart.Styles.Pie pie1;
    private void InitializeChart()
    {
        pie1 = new Steema.TeeChart.Styles.Pie(WebChart1.Chart);
        pie1.FillSampleValues();
        pie1.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Percent;
        WebChart1.GetLegendText += new Steema.TeeChart.GetLegendTextEventHandler(WebChart1_GetLegendText);
    }
Could you please, check if previous code works as you want?

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

phil1995
Newbie
Newbie
Posts: 31
Joined: Fri Dec 16, 2005 12:00 am
Location: Hattiesburg, Ms.
Contact:

Re: Customising Legend Text on a WebChart

Post by phil1995 » Mon Oct 11, 2010 12:57 pm

As mentioned earlier, the GetLegendText is not available from the WebChart9. When I type Webchart9. , there is no GetLegendText in the intellisense.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Customising Legend Text on a WebChart

Post by Sandra » Mon Oct 11, 2010 1:36 pm

Hello priya1995,

Previous code I have attached in this thread works fine for me in last version 2 of TeeChart.Net. If you don't find GetLegendText() to runtime, Please, go to design time and try to find it next the proprieties of objects. If you still can't find GetLegendText(), could you please, say us exactly what is the number of version 2 are you using?
For example:
Release Notes 4th February 2009
TeeChart.NET version 2
Build 2.0.3309.32488
Compiled in .NET Framework 1.1
Build 2.0.3309.32489
Compiled in .NET Framework 2.0
Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

phil1995
Newbie
Newbie
Posts: 31
Joined: Fri Dec 16, 2005 12:00 am
Location: Hattiesburg, Ms.
Contact:

Re: Customising Legend Text on a WebChart

Post by phil1995 » Mon Oct 11, 2010 1:38 pm

Release Notes 22nd January 2009
TeeChart.NET version 2
Build 2.0.3309.32488
Compiled in .NET Framework 1.1
Build 2.0.3309.32489
Compiled in .NET Framework 2.0

phil1995
Newbie
Newbie
Posts: 31
Joined: Fri Dec 16, 2005 12:00 am
Location: Hattiesburg, Ms.
Contact:

Re: Customising Legend Text on a WebChart

Post by phil1995 » Mon Oct 11, 2010 1:45 pm

When I go to the design and look under the events, I see the GetLegendText. I double clicked it and it made the WebChart9_GetLegendText event.

When I go to use any of the code you suggested, it doesnt recognize WebChart9.GetLegendText

When I go into the event and try to access the legend properties with WebChart9.Legend, it doesnt recognize this either.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Customising Legend Text on a WebChart

Post by Sandra » Mon Oct 11, 2010 2:00 pm

Hello phil1995,

Could you please, send us a simple project, because we can reproduce your problem here?

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply