Clean up a few sample issues (#8790)

This commit is contained in:
Evert Timberg 2021-04-02 17:25:14 -04:00 committed by GitHub
parent 98e890cc7b
commit 96dd201028
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -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 |

View File

@ -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();
}

View File

@ -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 {