mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
Clean up a few sample issues (#8790)
This commit is contained in:
parent
98e890cc7b
commit
96dd201028
@ -237,7 +237,7 @@ It is common to want to apply a configuration setting to all created bar charts.
|
||||
|
||||
The following shows the relationship between the bar percentage option and the category percentage option.
|
||||
|
||||
```text
|
||||
```
|
||||
// categoryPercentage: 1.0
|
||||
// barPercentage: 1.0
|
||||
Bar: | 1.0 | 1.0 |
|
||||
|
@ -8,6 +8,7 @@ const actions = [
|
||||
{
|
||||
name: 'Mode: index',
|
||||
handler(chart) {
|
||||
chart.options.interaction.axis = 'xy';
|
||||
chart.options.interaction.mode = 'index';
|
||||
chart.update();
|
||||
}
|
||||
@ -15,6 +16,7 @@ const actions = [
|
||||
{
|
||||
name: 'Mode: dataset',
|
||||
handler(chart) {
|
||||
chart.options.interaction.axis = 'xy';
|
||||
chart.options.interaction.mode = 'dataset';
|
||||
chart.update();
|
||||
}
|
||||
@ -22,6 +24,7 @@ const actions = [
|
||||
{
|
||||
name: 'Mode: point',
|
||||
handler(chart) {
|
||||
chart.options.interaction.axis = 'xy';
|
||||
chart.options.interaction.mode = 'point';
|
||||
chart.update();
|
||||
}
|
||||
@ -29,6 +32,7 @@ const actions = [
|
||||
{
|
||||
name: 'Mode: nearest',
|
||||
handler(chart) {
|
||||
chart.options.interaction.axis = 'xy';
|
||||
chart.options.interaction.mode = 'nearest';
|
||||
chart.update();
|
||||
}
|
||||
|
@ -57,6 +57,12 @@ const data = {
|
||||
// Create a custom tooltip positioner to put at the bottom of the chart area
|
||||
components.Tooltip.positioners.bottom = function(items) {
|
||||
const pos = components.Tooltip.positioners.average(items);
|
||||
|
||||
// Happens when nothing is found
|
||||
if (pos === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const chart = this._chart;
|
||||
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user