To remove all of the controls, you can simple call:
chart.showControls(false);
To remove a single control, you have to set the chart._options.controlOptions variable to set the controls that you want to show. The default options are:['Stacked', 'Stream', 'Expanded']
So you if need to remove one of the control options, set chart._options.controlOptions to an array with that option omitted:
chart._options.controlOptions = ['Stacked', 'Stream']; // hide 'Expanded' view chart._options.controlOptions = ['Stacked', 'Expanded']; // hide 'Stream' view chart._options.controlOptions = ['Expanded', 'Stream']; // hide 'Stacked' view
The chart will default to the first option, so in the last example, 'Expanded' will be the default view. If the order of controls is switched, 'Stream' will be the default view.
Thank you -- this was very helpful to me.
ReplyDeleteMake sure your nvd3.js version supports this — the showControls method is available in versions compatible with stackedAreaChart.
ReplyDeleteLet me know if you also want to remove the legend or other chart elements. relaciones publicas en mercadotecnia