Page 1 of 1

View legend symbols at custom location

Posted: Fri Dec 15, 2023 5:46 am
by 15678758
Hello Team,

I am using Steema tee chart version for WPF 4.1.2017.2143.
As per my requirement, I need to show a legend symbols in a different table with project specific information. Is there any possibility to view legend symbols or repaint legend symbols at custom location.

Re: View legend symbols at custom location

Posted: Fri Dec 15, 2023 8:40 am
by Marc
Greetings,

Please see the following tutorial:

https://steema.com/docs/teechart/net/tu ... Design.htm

See this example for modification of the Legend symbols themselves at runtime:

https://github.com/Steema/TeeChart-NET- ... olFlags.cs

(whole project loadable here: https://github.com/Steema/TeeChart-NET- ... tDemoNET60)

Regards,
Marc Meumann

Re: View legend symbols at custom location

Posted: Mon Dec 18, 2023 12:18 pm
by 15678758
Hello Marc,

this solution shall modify the changes at legend section, but we want to use that symbol at customized project specific editor like PDF table and there need to repaint/redraw the symbol of the specific series as shown in this attachment
LegendInPDFTable.png
LegendInPDFTable.png (30.54 KiB) Viewed 17576 times
This image is generated in PDF file. So any way to get this as a shape?

Thanks for your support.

Re: View legend symbols at custom location

Posted: Thu Dec 21, 2023 8:22 am
by 15678758
Hello Marc,

Is there any update on this ?

Re: View legend symbols at custom location

Posted: Thu Dec 21, 2023 8:36 am
by Marc
Hello,

We were cross.checking options as it's not entirely clear to us from your description how you are creating the combined pdf output, and example of how you are doing that would be useful. On the other hand, we're still of the view that defining your own image symbol outside the Chart for your legend table (I assume that is outside of the chart) and then re-using that symbol in the Legend is the way to go.

The code for that is included in the example I linked:

for NET framework 4:

Code: Select all

private void Symbol_OnSymbolDraw(object sender, SymbolDrawEventArgs e) 
{
	if(this.checkBox1.Checked) 
	{
		Rectangle tmpR = e.Rect;
		tmpR.Inflate(-1,-1);

		System.Drawing.Bitmap bmp = new Bitmap(imageList1.Images[e.ValueIndex]);
		tChart1.Chart.Graphics3D.Draw(tmpR, bmp, Steema.TeeChart.Drawing.ImageMode.Stretch, false);
	}
}
In this case taking the image from a list, but you could assign your bitmap symbol here.

Regards,
Marc

Re: View legend symbols at custom location

Posted: Wed Dec 27, 2023 11:38 am
by 15678758
Hello Marc,

Thank you for your solution.

We want to do vice versa. We want to use legend symbol of a chart in a our PDF table so is there any way by which i can get series and its legend symbols.

Your help is very much appreciated.

Re: View legend symbols at custom location

Posted: Thu Dec 28, 2023 1:21 pm
by Marc
Hello,

You can't get the symbol itself but you can get most of the information you need to plot it. The event from the previous examples offers up the rectangular size of the symbol to be plotted and the colours can be extracted from the Series value index, then knowing if you're going to have a square, triangular or line symbol according to default Chart settings, just use the PaintEventArgs e.Graphics in Form_paint or similar, to plot the symbol where you want it.

Regards,
Marc