Hi,
I'm using the igDataChart and I want to show the legends of a particular series. The only way I found to do this is to create a custom <div> in wich legend are going to be shown, assign an id and then set the id in the element option of the legend.
<div>
element
legend
To start with, I'm not even sure why I need to create the div element as it perfectly could be created by the igDataChart control itself. Besides, I don't want to have an id in that div as I will be showing multiple charts on the same page and having ids could lead to an id duplication. How can I do to set the element option in some other way (i.e. custom selector, jQuery object or DOM Element)?
Thanks,
Hello Hugo,
Thank you for contacting Infragistics Support!
After doing some research, I found that when the legend property of the igDataChart is set (legend: { element: “elementID” }) it internally tries to find a DOM element with id = “elemendID”. As soon as such element has been found an html table would be rendered within it. Each row of this table will represent a particular series of the chart.
Having this in mind you can consider this element (which could be actually not only <div> but any other selector as well (span, p etc.)) as a hook which will indicate the igDataChart where to render its legend.
Having this in mind I can verify that currently the only way of using the build-in legend functionality is via providing the id of some DOM element to the igDataChart. In case your requirements is to pass not an id but an HTML element or something else I can suggest submitting a new product idea. You can suggest new product ideas for future versions (or vote for existing ones) here.
There are many benefits to submitting a product idea:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
The Product Idea site puts you in the driver’s seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Please let me know if you need any further information!
Best Regards, Martin Evtimov Associate Software Developer Infragistics, Inc.
Hi Martin, thanks for the reply.
I've just suggested the product idea although at this point of maturity of the product I think this kind of things are closer to an issue rather than just a suggestion.
Anyways, I'd also very much appreciate your help with another thing related to chart's legend. I have a stacked-bar chart like so:
The legend I want to show is regarding each fragment on the bars (i.e., each color). But I want to show not only the fragment name but also a value for that fragment in the whole graph. I cannot seem to find how can I customize the legend's content. How can I do this?
Thanks