defaultColor | Color | 'rgba(0,0,0,0.1)' |
legendCallback | Function | ` function (chart) { // the chart object to generate a legend from. }` | Function to generate a legend. Default implementation returns an HTML string.
+The global options for the chart title is defined in `Chart.defaults.global.title`
+
+Name | Type | Default | Description
+--- | --- | --- | ---
+display | Boolean | true | Show the title block
+position | String | 'top' | Position of the title. 'top' or 'bottom' are allowed
+fullWidth | Boolean | true | Marks that this box should take the full width of the canvas (pushing down other boxes)
+fontColor | Color | '#666' | Text color
+fontFamily | String | 'Helvetica Neue' |
+fontSize | Number | 12 |
+fontStyle | String | 'bold' |
+padding | Number | 10 | Number of pixels to add above and below the title text
+text | String | '' | Title text
+
+The global options for the chart legend is defined in `Chart.defaults.global.legend`
+
+Name | Type | Default | Description
+--- | --- | --- | ---
+display | Boolean | true | Is the legend displayed
+position | String | 'top' | Position of the legend. Options are 'top' or 'bottom'
+fullWidth | Boolean | true | Marks that this box should take the full width of the canvas (pushing down other boxes)
+onClick | Function | false | A callback that will override the default behavior of toggling the datasets
+labels |-|-|-
+*labels*boxWidth | Number | 40 | Width of coloured box
+*labels*fontSize | Number | 12 | Font size
+*labels*fontStyle | String | "normal" |
+*labels*fontColor | Color | "#666" |
+*labels*fontFamily | String | "Helvetica Neue" |
+*labels*padding | Number | 10 | Padding between rows of colored boxes
+*labels*callback: | Function | `function(dataset) { return '' + value; } | Generate the text for a dataset in the label
+
The global options for tooltips are defined in `Chart.defaults.global.tooltips`.
Name | Type | Default | Description
Chart = root.Chart,
helpers = Chart.helpers;
- Chart.defaults.legend = {
+ Chart.defaults.global.legend = {
display: true,
position: 'top',
fontColor: "#666",
fontFamily: "Helvetica Neue",
padding: 10,
- reverse: false,
- display: true,
- callback: function(value) {
- return '' + value;
+ callback: function(dataset) {
+ return '' + dataset.label;
},
},
};
initialize: function(config) {
helpers.extend(this, config);
- this.options = helpers.configMerge(Chart.defaults.legend, config.options);
+ this.options = helpers.configMerge(Chart.defaults.global.legend, config.options);
// Contains hit boxes for each dataset (in dataset order)
this.legendHitBoxes = [];
beforeBuildLabels: helpers.noop,
buildLabels: function() {
this.labels = this.chart.data.datasets.map(function(dataset) {
- return this.options.labels.callback.call(this, dataset.label);
+ return this.options.labels.callback.call(this, dataset);
}, this);
},
afterBuildLabels: helpers.noop,
Chart = root.Chart,
helpers = Chart.helpers;
- Chart.defaults.title = {
-
- display: true,
+ Chart.defaults.global.title = {
+ display: false,
position: 'top',
fullWidth: true, // marks that this box should take the full width of the canvas (pushing down other boxes)
initialize: function(config) {
helpers.extend(this, config);
- this.options = helpers.configMerge(Chart.defaults.title, config.options);
+ this.options = helpers.configMerge(Chart.defaults.global.title, config.options);
// Contains hit boxes for each dataset (in dataset order)
this.legendHitBoxes = [];