Combine Category+SubCategory in Bar Graph CategoryAxis text

7 posts, 1 answers
  1. Stephen
    Stephen avatar
    8 posts
    Member since:
    Jul 2013

    Posted 04 Sep 2013 Link to this post

    I've got a bar graph that is bound to the result of a query.
    The query may be grouped by Category, or Category + SubCategory

    The data is displayed visually correctly, however, I'm only able to display either the category OR the subcategory across the category axis.  
    How can I A. display both, and B. wrap the text so that it will fit?
  2. Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 06 Sep 2013 Link to this post

    Hi Stephen,

    As I can understand you correctly you need a multiline text am I right? This feature is not supported by the Kendo Chart and there is no possible workaround. We will add it for the next official releases. So stay tuned. 

    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. Answer
    Stephen
    Stephen avatar
    8 posts
    Member since:
    Jul 2013

    Posted 06 Sep 2013 Link to this post

    Multiline text was one of the things I was after, but I can rotate 90deg to reduce this need for the moment.  What I really need is the ability to set the categoryAxis text to display both the category and subcategory.
    I found a workaround.. which is to define multiple category axis. 
    categoryAxis:
    [{
       field: cPrimaryCat,
        labels: [{
            rotation: 90
        }
    }, {
       field: cSecondaryCat,
        labels: [{
            rotation: 90
        }
    }],
    or
    $categoryAxisA->field(cPrimaryCat),
              ->labels(array('rotation' => -90));
    $categoryAxisB->field(cSecondaryCat),
              ->labels(array('rotation' => -90));
    chart->addCategoryAxisItem($categoryAxisA)
        ->addCategoryAxisItem($categoryAxisB)
  4. Maksim
    Maksim avatar
    22 posts
    Member since:
    Apr 2013

    Posted 15 Jan 2015 Link to this post

    hi, we have same problem

    we use categoryAxis.labels.template to render categories bold

    # if (dataItem.is_category) { # <tspan style="font-weight: bold">  # } # #=value#  # if (dataItem.is_category) { # </tspan> # } #
     - it is ugly
     - we can't export it to image: chart.svg() generates non-valid svg

     - are there any valid method to make some categories (groups) bold or italic?
     - are there another method to group categories and subcategories along category axis?
  5. T. Tsonev
    Admin
    T. Tsonev avatar
    2817 posts

    Posted 19 Jan 2015 Link to this post

    Hello,

    There's no better option at the moment, but we hope this will change with the next major release.
    We plan to add "visual templates" that will allow you to override the rendering of many chart elements, including labels.

    The visual templates are free-form functions that employ the Drawing API to produce the visual elements.
    These elements are live, in the sense that they can be updated later on and will fire events.

    Thank you for your patience.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Maksim
    Maksim avatar
    22 posts
    Member since:
    Apr 2013

    Posted 19 Jan 2015 in reply to T. Tsonev Link to this post

    Hi, I'd like to share one thing.
    We use chart.svg() result to convert it to .png image via librsvg
    Sometimes it output blank image, in some other cases it produces normal png image.
    I've found cause
    <clipPath id='8d869faf-02fb-44e9-aeff-246cb3a8ff71'>
    sometimes id starts with digit, other time with letter
    id value cannot be uuid (xml id attribute value must be xml name - can't start width digit, see http://www.w3.org/TR/xml/#sec-attribute-types)
    I've removed id's from svg completely, it solved my problem (empty image when pass svg to png via rsvg or imagemagick)
    Could you please review and fix this?
  7. T. Tsonev
    Admin
    T. Tsonev avatar
    2817 posts

    Posted 21 Jan 2015 Link to this post

    Hello,

    Thanks for the heads-up. We'll rework the code to use safe IDs.

    I've updated our Telerik points as a token of gratitude for your involvement.

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