module Ext_chart_Label:Labels is a mixin to the Series class. Labels meth ...sig
..end
Labels is a mixin to the Series class. Labels methods are implemented in each of the Series (Pie, Bar, etc) for label creation and placement.
The 2 methods that must be implemented by the Series are:
The application can override these methods to control the style and location of the labels. For instance, to display the labels in green and add a '+' symbol when the value of a Line series exceeds 50:
Ext.define('Ext.chart.series.MyLine', {
extend: 'Ext.chart.series.Line',
alias: ['series.myline', 'Ext.chart.series.MyLine'],
type: 'MYLINE',
onPlaceLabel: function(label, storeItem, item, i, display, animate){
if (storeItem.data.y >= 50) {
label.setAttributes({
fill: '#080',
text: "+" + storeItem.data.y
}, true);
}
return this.callParent(arguments);
}
});
Note that for simple effects, like the example above, it is simpler for the application to provide a label.renderer function in the config:
label: {
renderer: function(value, label, storeItem, item, i, display, animate, index) {
if (value >= 50) {
label.setAttributes({fill:'#080'});
value = "+" + value;
}
return value;
}
}
The rule of thumb is that to customize the value and modify simple visual attributes, it
is simpler to use a renderer function, while overridding onCreateLabel
and onPlaceLabel
allows the application to take entire control over the labels.
class type t =object
..end
class type configs =object
..end
class type events =object
..end
class type statics =object
..end
val of_configs : configs Js.t -> t Js.t
of_configs c
casts a config object c
to an instance of class t
val to_configs : t Js.t -> configs Js.t
to_configs o
casts instance o
of class t
to a config object