0

I want to update the text and symbol on legend items. I am creating legend text with symbol using series and CSeriesPointerItems. I thought of using OnGetLegendTextTchart event, but it is not getting fired. OnAfterDrawTchart event is getting fired. So I am unable to understanding why is it not happening? Can you let me know what am I missing or how can we update the legend text and symbol?

Yeray
  • 5,009
  • 1
  • 13
  • 25
Rahul
  • 13
  • 6

1 Answers1

1

There's an example showing how to use the Symbol OnDraw event to change the symbol on the legend. Find it at "All Features\Welcome !\Miscellaneous\Legend\Symbol OnDraw" in the Features Demo shipped with the installation.

There's another example showing how to use the Items property on the Legend to change the texts of the same. Find it at "All Features\Welcome !\Miscellaneous\Legend\Items property" in the Features Demo shipped with the installation.

Yeray
  • 5,009
  • 1
  • 13
  • 25
  • How can we make text as multiline ? after 10 character or one word, it should start writing in next line. i wanted to remove border and change color of legend window. – Rahul Mar 11 '15 at 11:46
  • Multiline in the legend isn't supported yet as you can read [here](http://www.teechart.net/support/viewtopic.php?f=3&t=1663) – Yeray Mar 11 '15 at 15:07
  • Thanks Yeray for your reply. can we use this below mention link to draw Legend with multiple line ? Sorry can we help to write this code in c++. http://stackoverflow.com/questions/23906386/how-to-create-multiline-legend-in-teechart – Rahul Mar 11 '15 at 17:58
  • That was Delphi but yes, you should be able to do the same with TeeChart ActiveX and C++ too. If you find problems translating it, share the problems you find with it adding a simple demo. – Yeray Mar 13 '15 at 08:43
  • Hi Yeray, I am creating a custom legend. How we create symbol like psCircle or psRectangle or psDiamond outside of chart ? I want to add symbol before my custom legend text. can you provide me way to do that. – Rahul Mar 31 '15 at 12:04
  • You can draw Rectangles and Ellipses at OnAfterDraw event – Yeray Apr 01 '15 at 09:40
  • I have used m_ctrlChart.GetTools().Add(tcRectangle); to create diamond and other shapes. but i am unable to clear previous one. I want to clear diamond when i select another check box to display rectangle. it is displaying diamond and rectangle both. – Rahul Apr 01 '15 at 12:36
  • This GetTools().Add() function returns an integer to be used as index to access the tool later. You can use it to disable it: rect = m_ctrlChart.GetTools().Add(tcRectangle); m_ctrlChart.GetTools().GetItems(rect).SetActive(false); – Yeray Apr 07 '15 at 08:01