Pie Chart Legend Dissapearning

2 posts, 0 answers
  1. Luke
    Luke avatar
    1 posts
    Member since:
    Mar 2015

    Posted 17 Mar 2015 Link to this post

    Hi

    Trying to integrate a pie graph into my app. The pie chart is showing, however, when I click a legend key, it disappears and I cant get it back. If I look at the demos, its supposed to 'grey' out the legend so I can click it agin:

    Markup:

     <div data-role="view" data-layout="child" data-title="Home" id="assetView" data-model="app.homeView.viewModel" data-init="app.homeView.init">
                     
                     <div id="example" >
        
        
                <div data-role="chart"
                     data-legend="{ position: 'bottom', visible: true }"
                     data-theme="bootstrap"
                     data-tooltip="{
                        visible: true,
                        template: '<div>#: kendo.toString(dataItem.name , \'d\')#</div><div>Share Count:#: value #</div>'
                        }"
                     data-series="[{
                                    type: 'pie',
                                    field: 'y',
                                    categoryField: 'name',
                                    padding: 10,
                                   visibleInLegendField: 'visible',
                                  labels: {
                                   visible: true,
                                   position: 'outsideEnd',
                                    template: '#: value #%',
                                    background: 'transparent'
                                  
                                  },
                                  }]"
                     
                     data-bind="source: groupsSource">
     

        

    </div>
                         
                         
     
                     </div>


    View:

    define(['kendo', 'data', 'utils'], function (kendo, data, utils) {

       var groupsViewModel = kendo.observable({
          groupsSource: data.openDefects(),
          
       })

       return {
          init: function (initEvt) {
            kendo.bind($("#example"), groupsViewModel);
          },
          beforeShow: function (beforeShowEvt) {},
          show: function (showEvt) {},
          }
          viewModel: groupsViewModel
       
    });
          


  2. Martin Yankov
    Admin
    Martin Yankov avatar
    177 posts

    Posted 20 Mar 2015 Link to this post

    Hello Luke,

    You have set a visibleInLegendField property for the series you use. This property indicates which field from the source will tell if the data item will be visible in the legend. You can remove the visibleInLegendField value and you should see the greyed out legend items. Do you need this property? Is there a 'visible' field in your data source?

    Regards,
    Martin Yankov
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
Back to Top