Partial legend for grouped and stacked bar chart

4 posts, 0 answers
  1. Olli
    Olli avatar
    5 posts
    Member since:
    Mar 2013

    Posted 06 Aug 2013 Link to this post

    I've got chart that is basically like this: http://jsfiddle.net/huHVd/ (slightly modified from the Kendo examples).

    I'm looking for chart legend that would be created only partially so that every legend item would be shown once (not twice as it is in the exmaple chart).

    Any comments on that?

    Thanks.
  2. Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 06 Aug 2013 Link to this post

    Hello Olli,

    This functionality is not available by the Chart and I can't offer you a workaround. Please excuse us for the inconvenience that this may cause. 

    Regards,
    Hristo Germanov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Olli
    Olli avatar
    5 posts
    Member since:
    Mar 2013

    Posted 12 Aug 2013 Link to this post

    Short answer to my own question in case if someone other has similar problem: I got it working by manually modifying (with JavaScript) generated SVG in html. In my case I look for the last <g> element in the SVG document, read the legend items (x and y coordinates, names and colors of the boxes) and remove all of them. After that I create new ones without duplicates and add the new elements to the <g> element. Looking the genereted SVG should give you example of what kind of elements you should create for the SVG.

    Couldn't figure any better solution than this out. Maybe not the most efficient way to first generate SVG, and then replace it with another, but it works :)

    Olli
  4. Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 13 Aug 2013 Link to this post

    Hello Olli,

    I missed something in a previous post and I apologize for that.

    We have a visibleInLegend property that will fit in your case. You need to set it to false in this series that you don't want to show in the legend. I have updated your test sample: http://jsfiddle.net/huHVd/3/

    Regards,
    Hristo Germanov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top