1. Is it possible to have the label associated with each column in a stacked column chart to have multiple lines of text? I tried putting "<br/>" but that did not work.
2. How can I label each stacked part of the column? Mouse over works fine, but I would like text to be display on each segment of the stacked column.
FYI, I am using 13.2.
Are these features not available for igDataChart?
Hello haimai ,
Thank you for posting in our forum. Please find the answers to your questions below.
1) Is it possible to have the label associated with each column in a stacked column chart to have multiple lines of text?
I’m assuming you mean the tooltips that appear when you hover over a stacked column.
For the tooltips you can assign a tooltip template so that the items can be displayed in separate lines.
There’s a similar example here:
2) How can I label each stacked part of the column?
The tooltips by design appear only on hover. If you want to add permanent labels on top of the stacked column elements you could use a custom marker template.
Markers appear on the data points of the series. By setting a marker template you are taking over the rendering of the marker completely, which would allow you to add text or some other representation of the data point.
There’s a similar example with a column chart where text is added on top of each column element here:
A similar approach can be used to add text on each stacked chart.
I’ve attached an example for your reference where for one of the series a custom marker template is added. It will add the value of the stacked bar segments of the specific series as a label in the middle of segment.
Let me know if you’re aiming to achieve something similar.
Developer Support Engineer II
For #1, I meant to say that I wanted the x-axis label associated with each stacked column to have multiple lines. For example, on your example at http://www.igniteui.com/data-chart/overview, how could the x-axis be Bejing China; Delhi India, etc with the city on one line and the country on the next?
Thank you for the clarification.
While there is a formatLabel method you could use to format the text of the label it seems that you cannot force the label to span on more than 1 line with it.
One possible solution is to disable the default labels and manually add them to the canvas at the position you want. You could get the x and y positions of each series member in a custom markerTemplate and draw them on the canvas in that position on the refreshCompleted event .I’ve attached an example on how this can be implemented.
Let me know if this would work in your scenario.
I’m just following up to see if you’ve been able to resolve your issue. If you have any questions or concerns or if you need further assistance please let me know.
Developer Support Engineer