This is a migrated thread and some comments may be shown as answers.

Pie Chart Legend Dissapearning

1 Answer 39 Views
Show your code
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Luke
Top achievements
Rank 1
Luke asked on 17 Mar 2015, 09:29 AM
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
   
});
      


1 Answer, 1 is accepted

Sort by
0
Martin Yankov
Telerik team
answered on 20 Mar 2015, 08:42 AM
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.

 
Tags
Show your code
Asked by
Luke
Top achievements
Rank 1
Answers by
Martin Yankov
Telerik team
Share this question
or