Page 1 of 1

Customising Legend Text on a WebChart

Posted: Fri Oct 08, 2010 3:57 pm
by 9639571
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)

Re: Customising Legend Text on a WebChart

Posted: Mon Oct 11, 2010 8:09 am
by 10050769
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,

Re: Customising Legend Text on a WebChart

Posted: Mon Oct 11, 2010 12:57 pm
by 9639571
As mentioned earlier, the GetLegendText is not available from the WebChart9. When I type Webchart9. , there is no GetLegendText in the intellisense.

Re: Customising Legend Text on a WebChart

Posted: Mon Oct 11, 2010 1:36 pm
by 10050769
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,

Re: Customising Legend Text on a WebChart

Posted: Mon Oct 11, 2010 1:38 pm
by 9639571
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

Re: Customising Legend Text on a WebChart

Posted: Mon Oct 11, 2010 1:45 pm
by 9639571
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.

Re: Customising Legend Text on a WebChart

Posted: Mon Oct 11, 2010 2:00 pm
by 10050769
Hello phil1995,

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

Thanks,