Hi folks
I can change this setting from the Chart Editor by clicking the Legend tab, then the Symbols tab, then modifying the Width text box
Ive tried doing the following in code:
myChart.Legend.Symbol.Width = 5;
myChart.Legend.Symbol.WidthUnits = Steema.TeeChart.LegendSymbolSize.Pixels;
However the legend symbol width is not changed. Can I do this from code?
Changing Legend Symbol Width in Code?
Re: Changing Legend Symbol Width in Code?
Hello Dave,
I have made a simple code that increase an decrease width of legend symbols:
Could you please, tell us if this code works for you? Moreover, could you say what version of TeeChart.Net are you using?
I hope will helps.
Thanks,
I have made a simple code that increase an decrease width of legend symbols:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
bar1.FillSampleValues(5);
}
private void button1_Click(object sender, EventArgs e)
{
tChart1.Legend.Symbol.WidthUnits = Steema.TeeChart.LegendSymbolSize.Pixels;
tChart1.Legend.Symbol.Width = tChart1.Legend.Symbol.Width+5;
}
private void button2_Click(object sender, EventArgs e)
{
tChart1.Legend.Symbol.WidthUnits = Steema.TeeChart.LegendSymbolSize.Pixels;
tChart1.Legend.Symbol.Width = tChart1.Legend.Symbol.Width - 5;
}
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 |
Instructions - How to post in this forum |
Re: Changing Legend Symbol Width in Code?
Sandra
Thanks that works. Ive discovered I need to set the symbol width AFTER adding a series to the chart.
Thanks that works. Ive discovered I need to set the symbol width AFTER adding a series to the chart.
Re: Changing Legend Symbol Width in Code?
Hello Dave,
I am glad that solution works for you .
Thanks,
I am glad that solution works for you .
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |