extjs-gpl
Version:
GPL licensed version of Sencha Ext JS
40 lines (34 loc) • 1.42 kB
JavaScript
Ext.define('KitchenSink.view.charts.line.BasicController', {
extend: 'Ext.app.ViewController',
alias: 'controller.line-basic',
onAxisLabelRender: function (axis, label, layoutContext) {
// Custom renderer overrides the native axis label renderer.
// Since we don't want to do anything fancy with the value
// ourselves except appending a '%' sign, but at the same time
// don't want to loose the formatting done by the native renderer,
// we let the native renderer process the value first.
return layoutContext.renderer(label) + '%';
},
onSeriesTooltipRender: function (tooltip, record, item) {
tooltip.setHtml(record.get('month') + ': ' + record.get('data1') + '%');
},
onItemHighlightChange: function (chart, newHighlightItem, oldHighlightItem) {
this.setSeriesLineWidth(newHighlightItem, 4);
this.setSeriesLineWidth(oldHighlightItem, 2);
},
setSeriesLineWidth: function (item, lineWidth) {
if (item) {
item.series.setStyle({
lineWidth: lineWidth
});
}
},
onPreview: function () {
if (Ext.isIE8) {
Ext.Msg.alert('Unsupported Operation', 'This operation requires a newer version of Internet Explorer.');
return;
}
var chart = this.lookupReference('chart');
chart.preview();
}
});