@gitlab/ui 71.9.0 → 71.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/components/charts/area/area.js +11 -22
- package/dist/components/charts/bar/bar.js +3 -4
- package/dist/components/charts/column/column.js +5 -22
- package/dist/components/charts/heatmap/heatmap.js +4 -9
- package/dist/components/charts/line/line.js +11 -22
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/json/tokens.dark.json +198 -330
- package/dist/tokens/json/tokens.json +132 -132
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +67 -67
- package/package.json +1 -1
- package/src/components/charts/area/area.spec.js +82 -7
- package/src/components/charts/area/area.stories.js +24 -6
- package/src/components/charts/area/area.vue +21 -27
- package/src/components/charts/bar/bar.spec.js +7 -43
- package/src/components/charts/bar/bar.vue +3 -4
- package/src/components/charts/column/__snapshots__/column_chart.spec.js.snap +0 -12
- package/src/components/charts/column/column.vue +1 -23
- package/src/components/charts/column/column_chart.spec.js +13 -27
- package/src/components/charts/heatmap/heatmap.vue +4 -14
- package/src/components/charts/line/line.spec.js +120 -38
- package/src/components/charts/line/line.stories.js +21 -4
- package/src/components/charts/line/line.vue +21 -32
- package/src/tokens/color.theme.tokens.json +66 -66
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import { createMockChartInstance
|
|
2
|
+
import { createMockChartInstance } from '~helpers/chart_stubs';
|
|
3
3
|
import { expectHeightAutoClasses } from '~helpers/chart_height';
|
|
4
4
|
import {
|
|
5
5
|
mockDefaultLineData,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
mockDefaultStackedBarData,
|
|
9
9
|
} from '../../../utils/charts/mock_data';
|
|
10
10
|
import Chart from '../chart/chart.vue';
|
|
11
|
+
import ChartTooltip from '../tooltip/tooltip.vue';
|
|
11
12
|
import ColumnChart from './column.vue';
|
|
12
13
|
|
|
13
14
|
let mockChartInstance;
|
|
@@ -27,36 +28,28 @@ describe('column chart component', () => {
|
|
|
27
28
|
|
|
28
29
|
const chartItemClickedSpy = jest.fn();
|
|
29
30
|
const findChart = () => wrapper.findComponent(Chart);
|
|
30
|
-
const
|
|
31
|
-
|
|
31
|
+
const findChartTooltip = () => wrapper.findComponent(ChartTooltip);
|
|
32
|
+
|
|
33
|
+
const emitChartCreated = () => findChart().vm.$emit('created', mockChartInstance);
|
|
32
34
|
|
|
33
35
|
const factory = (props = defaultChartProps, slots = {}) => {
|
|
34
36
|
wrapper = shallowMount(ColumnChart, {
|
|
35
37
|
propsData: { ...props },
|
|
36
|
-
stubs: {
|
|
37
|
-
'chart-tooltip': ChartTooltipStub,
|
|
38
|
-
},
|
|
39
38
|
listeners: {
|
|
40
39
|
chartItemClicked: chartItemClickedSpy,
|
|
41
40
|
},
|
|
42
|
-
data() {
|
|
43
|
-
return {
|
|
44
|
-
chart: mockChartInstance,
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
41
|
slots,
|
|
48
42
|
});
|
|
49
43
|
};
|
|
50
44
|
|
|
51
45
|
beforeEach(() => {
|
|
52
|
-
mockChartInstance = createMockChartInstance();
|
|
53
|
-
|
|
54
46
|
factory();
|
|
47
|
+
|
|
48
|
+
mockChartInstance = createMockChartInstance();
|
|
49
|
+
emitChartCreated();
|
|
55
50
|
});
|
|
56
51
|
|
|
57
52
|
it('emits "created" when onCreated is called', () => {
|
|
58
|
-
wrapper.vm.onCreated(wrapper.vm.chart);
|
|
59
|
-
|
|
60
53
|
expect(wrapper.emitted('created')).toHaveLength(1);
|
|
61
54
|
});
|
|
62
55
|
|
|
@@ -126,18 +119,11 @@ describe('column chart component', () => {
|
|
|
126
119
|
});
|
|
127
120
|
|
|
128
121
|
describe('tooltip', () => {
|
|
129
|
-
it('
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
getChartOptions().xAxis.axisPointer.label.formatter(params);
|
|
135
|
-
|
|
136
|
-
await wrapper.vm.$nextTick();
|
|
137
|
-
|
|
138
|
-
const expectedTooltipTitle = `${params.seriesData[0].value[0]} (${defaultChartProps.xAxisTitle})`;
|
|
139
|
-
|
|
140
|
-
expect(findTooltip().text()).toContain(expectedTooltipTitle);
|
|
122
|
+
it('configures chart tooltip', async () => {
|
|
123
|
+
expect(findChartTooltip().props()).toMatchObject({
|
|
124
|
+
chart: mockChartInstance,
|
|
125
|
+
useDefaultTooltipFormatter: true,
|
|
126
|
+
});
|
|
141
127
|
});
|
|
142
128
|
});
|
|
143
129
|
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
<script>
|
|
3
3
|
import merge from 'lodash/merge';
|
|
4
4
|
import { WHITE, GRAY_100 } from '../../../../dist/tokens/js/tokens';
|
|
5
|
-
|
|
6
|
-
import { getDefaultTooltipContent } from '../../../utils/charts/config';
|
|
5
|
+
import { getTooltipTitle, getTooltipContent } from '../../../utils/charts/config';
|
|
7
6
|
import { HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
|
|
8
7
|
import { heatmapHues } from '../../../utils/charts/theme';
|
|
9
8
|
import { engineeringNotation } from '../../../utils/number_utils';
|
|
@@ -223,14 +222,8 @@ export default {
|
|
|
223
222
|
},
|
|
224
223
|
methods: {
|
|
225
224
|
defaultFormatTooltipText(params) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
params,
|
|
229
|
-
this.computedOptions.yAxis.name
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
this.$set(this.tooltip, 'content', tooltipContent);
|
|
233
|
-
this.tooltip.title = xLabels.join(', ');
|
|
225
|
+
this.tooltip.title = getTooltipTitle(params, this.computedOptions.xAxis.name);
|
|
226
|
+
this.tooltip.content = getTooltipContent(params, this.computedOptions.yAxis.name);
|
|
234
227
|
},
|
|
235
228
|
onCreated(chart) {
|
|
236
229
|
this.chart = chart;
|
|
@@ -268,10 +261,7 @@ export default {
|
|
|
268
261
|
<chart-tooltip v-if="chart" :chart="chart" :top="tooltip.top" :left="tooltip.left">
|
|
269
262
|
<template #title>
|
|
270
263
|
<slot v-if="formatTooltipText" name="tooltip-title"></slot>
|
|
271
|
-
<div v-else>
|
|
272
|
-
{{ tooltip.title }}
|
|
273
|
-
<template v-if="computedOptions.xAxis.name">({{ computedOptions.xAxis.name }})</template>
|
|
274
|
-
</div>
|
|
264
|
+
<div v-else>{{ tooltip.title }}</div>
|
|
275
265
|
</template>
|
|
276
266
|
<slot v-if="formatTooltipText" name="tooltip-content"></slot>
|
|
277
267
|
<tooltip-default-format v-else :tooltip-content="tooltip.content" />
|
|
@@ -2,7 +2,11 @@ import { nextTick } from 'vue';
|
|
|
2
2
|
import { shallowMount } from '@vue/test-utils';
|
|
3
3
|
|
|
4
4
|
import { LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE } from '~/utils/charts/constants';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
createMockChartInstance,
|
|
7
|
+
ChartTooltipStub,
|
|
8
|
+
chartTooltipStubData,
|
|
9
|
+
} from '~helpers/chart_stubs';
|
|
6
10
|
import { expectHeightAutoClasses } from '~helpers/chart_height';
|
|
7
11
|
|
|
8
12
|
import Chart from '../chart/chart.vue';
|
|
@@ -27,10 +31,13 @@ describe('line component', () => {
|
|
|
27
31
|
|
|
28
32
|
const emitChartCreated = () => findChart().vm.$emit('created', mockChartInstance);
|
|
29
33
|
|
|
30
|
-
const createShallowWrapper = (props = {},
|
|
34
|
+
const createShallowWrapper = ({ props = {}, ...options } = {}) => {
|
|
31
35
|
wrapper = shallowMount(LineChart, {
|
|
32
36
|
propsData: { option, data: [], ...props },
|
|
33
|
-
|
|
37
|
+
stubs: {
|
|
38
|
+
'chart-tooltip': ChartTooltipStub,
|
|
39
|
+
},
|
|
40
|
+
...options,
|
|
34
41
|
});
|
|
35
42
|
emitChartCreated();
|
|
36
43
|
};
|
|
@@ -59,12 +66,14 @@ describe('line component', () => {
|
|
|
59
66
|
|
|
60
67
|
it('are displayed if passed via annotations props', async () => {
|
|
61
68
|
createShallowWrapper({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
props: {
|
|
70
|
+
annotations: [
|
|
71
|
+
{
|
|
72
|
+
min: '',
|
|
73
|
+
max: '',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
68
77
|
});
|
|
69
78
|
|
|
70
79
|
await nextTick();
|
|
@@ -74,20 +83,22 @@ describe('line component', () => {
|
|
|
74
83
|
|
|
75
84
|
it('are displayed if passed via option props', async () => {
|
|
76
85
|
createShallowWrapper({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
props: {
|
|
87
|
+
option: {
|
|
88
|
+
series: [
|
|
89
|
+
{
|
|
90
|
+
name: 'annotations',
|
|
91
|
+
markPoint: {
|
|
92
|
+
data: [
|
|
93
|
+
{
|
|
94
|
+
xAxis: 10,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
data: [],
|
|
87
99
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
],
|
|
100
|
+
],
|
|
101
|
+
},
|
|
91
102
|
},
|
|
92
103
|
});
|
|
93
104
|
|
|
@@ -112,8 +123,8 @@ describe('line component', () => {
|
|
|
112
123
|
},
|
|
113
124
|
};
|
|
114
125
|
|
|
115
|
-
createShallowWrapper(
|
|
116
|
-
{
|
|
126
|
+
createShallowWrapper({
|
|
127
|
+
props: {
|
|
117
128
|
annotations: [
|
|
118
129
|
{
|
|
119
130
|
min: '',
|
|
@@ -121,12 +132,7 @@ describe('line component', () => {
|
|
|
121
132
|
},
|
|
122
133
|
],
|
|
123
134
|
},
|
|
124
|
-
|
|
125
|
-
stubs: {
|
|
126
|
-
'chart-tooltip': ChartTooltipStub,
|
|
127
|
-
},
|
|
128
|
-
}
|
|
129
|
-
);
|
|
135
|
+
});
|
|
130
136
|
|
|
131
137
|
wrapper.vm.onChartDataPointMouseOver(params);
|
|
132
138
|
|
|
@@ -137,13 +143,83 @@ describe('line component', () => {
|
|
|
137
143
|
});
|
|
138
144
|
});
|
|
139
145
|
|
|
140
|
-
describe('data tooltip
|
|
141
|
-
|
|
146
|
+
describe('data tooltip', () => {
|
|
147
|
+
it('is initialized', async () => {
|
|
142
148
|
createShallowWrapper();
|
|
149
|
+
|
|
150
|
+
await nextTick();
|
|
151
|
+
|
|
152
|
+
expect(findDataTooltip().props()).toMatchObject({
|
|
153
|
+
useDefaultTooltipFormatter: true,
|
|
154
|
+
chart: mockChartInstance,
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
describe('is customized via slots', () => {
|
|
159
|
+
const { params, title, content } = chartTooltipStubData;
|
|
160
|
+
|
|
161
|
+
it('customizes tooltip value', async () => {
|
|
162
|
+
const tooltipValueSlot = jest.fn().mockReturnValue('Value');
|
|
163
|
+
|
|
164
|
+
createShallowWrapper({
|
|
165
|
+
scopedSlots: {
|
|
166
|
+
'tooltip-value': tooltipValueSlot,
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
await nextTick();
|
|
170
|
+
|
|
171
|
+
expect(tooltipValueSlot).toHaveBeenCalledWith({ value: 9 });
|
|
172
|
+
expect(findDataTooltip().text()).toBe('Value');
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('customizes title', async () => {
|
|
176
|
+
const tooltipTitleSlot = jest.fn().mockReturnValue('Title');
|
|
177
|
+
|
|
178
|
+
createShallowWrapper({
|
|
179
|
+
scopedSlots: {
|
|
180
|
+
'tooltip-title': tooltipTitleSlot,
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
await nextTick();
|
|
184
|
+
|
|
185
|
+
expect(tooltipTitleSlot).toHaveBeenCalledWith({
|
|
186
|
+
params,
|
|
187
|
+
title,
|
|
188
|
+
});
|
|
189
|
+
expect(findDataTooltip().text()).toBe('Title');
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it('customizes content', async () => {
|
|
193
|
+
const tooltipContentSlot = jest.fn().mockReturnValue('Title');
|
|
194
|
+
|
|
195
|
+
createShallowWrapper({
|
|
196
|
+
scopedSlots: {
|
|
197
|
+
'tooltip-content': tooltipContentSlot,
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
await nextTick();
|
|
201
|
+
|
|
202
|
+
expect(tooltipContentSlot).toHaveBeenCalledWith({
|
|
203
|
+
params,
|
|
204
|
+
content,
|
|
205
|
+
});
|
|
206
|
+
expect(findDataTooltip().text()).toBe('Title');
|
|
207
|
+
});
|
|
143
208
|
});
|
|
144
209
|
|
|
145
|
-
it('is
|
|
146
|
-
|
|
210
|
+
it('is customized via formatting function', async () => {
|
|
211
|
+
createShallowWrapper({
|
|
212
|
+
props: {
|
|
213
|
+
formatTooltipText: jest.fn(),
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
await nextTick();
|
|
218
|
+
|
|
219
|
+
expect(findDataTooltip().props()).toMatchObject({
|
|
220
|
+
useDefaultTooltipFormatter: false,
|
|
221
|
+
chart: mockChartInstance,
|
|
222
|
+
});
|
|
147
223
|
});
|
|
148
224
|
});
|
|
149
225
|
|
|
@@ -158,7 +234,9 @@ describe('line component', () => {
|
|
|
158
234
|
|
|
159
235
|
it('is inline if correct prop value is set', async () => {
|
|
160
236
|
createShallowWrapper({
|
|
161
|
-
|
|
237
|
+
props: {
|
|
238
|
+
legendLayout: LEGEND_LAYOUT_INLINE,
|
|
239
|
+
},
|
|
162
240
|
});
|
|
163
241
|
|
|
164
242
|
await nextTick();
|
|
@@ -168,7 +246,9 @@ describe('line component', () => {
|
|
|
168
246
|
|
|
169
247
|
it('is tabular if correct prop value is set', async () => {
|
|
170
248
|
createShallowWrapper({
|
|
171
|
-
|
|
249
|
+
props: {
|
|
250
|
+
legendLayout: LEGEND_LAYOUT_TABLE,
|
|
251
|
+
},
|
|
172
252
|
});
|
|
173
253
|
|
|
174
254
|
await nextTick();
|
|
@@ -177,7 +257,9 @@ describe('line component', () => {
|
|
|
177
257
|
});
|
|
178
258
|
it('can be hidden', async () => {
|
|
179
259
|
createShallowWrapper({
|
|
180
|
-
|
|
260
|
+
props: {
|
|
261
|
+
showLegend: false,
|
|
262
|
+
},
|
|
181
263
|
});
|
|
182
264
|
|
|
183
265
|
await nextTick();
|
|
@@ -188,7 +270,7 @@ describe('line component', () => {
|
|
|
188
270
|
|
|
189
271
|
describe('height', () => {
|
|
190
272
|
expectHeightAutoClasses({
|
|
191
|
-
createComponent: createShallowWrapper,
|
|
273
|
+
createComponent: (props) => createShallowWrapper({ props }),
|
|
192
274
|
findContainer: () => wrapper,
|
|
193
275
|
findChart,
|
|
194
276
|
});
|
|
@@ -56,7 +56,7 @@ const defaultOptions = {
|
|
|
56
56
|
},
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
const template = `<gl-line-chart
|
|
59
|
+
const template = (content = '') => `<gl-line-chart
|
|
60
60
|
:data="data"
|
|
61
61
|
:option="option"
|
|
62
62
|
:thresholds="thresholds"
|
|
@@ -64,7 +64,9 @@ const template = `<gl-line-chart
|
|
|
64
64
|
:includeLegendAvgMax="includeLegendAvgMax"
|
|
65
65
|
:showLegend="showLegend"
|
|
66
66
|
:height="height"
|
|
67
|
-
|
|
67
|
+
>
|
|
68
|
+
${content}
|
|
69
|
+
</gl-line-chart>`;
|
|
68
70
|
|
|
69
71
|
const generateProps = ({
|
|
70
72
|
data = defaultData,
|
|
@@ -87,7 +89,7 @@ const generateProps = ({
|
|
|
87
89
|
const Template = (_args, { argTypes }) => ({
|
|
88
90
|
props: Object.keys(argTypes),
|
|
89
91
|
components,
|
|
90
|
-
template,
|
|
92
|
+
template: template(),
|
|
91
93
|
});
|
|
92
94
|
|
|
93
95
|
export const Default = Template.bind({});
|
|
@@ -99,7 +101,7 @@ WithThreshold.args = generateProps({
|
|
|
99
101
|
});
|
|
100
102
|
|
|
101
103
|
export const WithAnnotationsAsProps = Template.bind({});
|
|
102
|
-
WithAnnotationsAsProps.
|
|
104
|
+
WithAnnotationsAsProps.storyName = 'with annotations as props (recommended)';
|
|
103
105
|
WithAnnotationsAsProps.args = generateProps({
|
|
104
106
|
...mockAnnotationsConfigs,
|
|
105
107
|
data: [
|
|
@@ -200,6 +202,21 @@ NoLegend.args = generateProps({
|
|
|
200
202
|
showLegend: false,
|
|
201
203
|
});
|
|
202
204
|
|
|
205
|
+
export const WithCustomTooltip = (_args, { argTypes }) => ({
|
|
206
|
+
props: Object.keys(argTypes),
|
|
207
|
+
components,
|
|
208
|
+
template: template(`
|
|
209
|
+
<template #tooltip-title="{ params }">{{params && params.value}}</template>
|
|
210
|
+
<template #tooltip-content="{ params }">
|
|
211
|
+
<div v-for="p in params && params.seriesData">{{p.seriesName}}: {{p.value[1]}}</div>
|
|
212
|
+
</template>
|
|
213
|
+
`),
|
|
214
|
+
});
|
|
215
|
+
WithCustomTooltip.args = generateProps();
|
|
216
|
+
WithCustomTooltip.parameters = {
|
|
217
|
+
storyshots: { disable: true },
|
|
218
|
+
};
|
|
219
|
+
|
|
203
220
|
export default {
|
|
204
221
|
title: 'charts/line-chart',
|
|
205
222
|
component: GlLineChart,
|
|
@@ -30,8 +30,6 @@ import {
|
|
|
30
30
|
mergeSeriesToOptions,
|
|
31
31
|
mergeAnnotationAxisToOptions,
|
|
32
32
|
lineStyle,
|
|
33
|
-
// eslint-disable-next-line import/no-deprecated
|
|
34
|
-
getDefaultTooltipContent,
|
|
35
33
|
} from '../../../utils/charts/config';
|
|
36
34
|
import {
|
|
37
35
|
LEGEND_LAYOUT_INLINE,
|
|
@@ -44,7 +42,6 @@ import {
|
|
|
44
42
|
} from '../../../utils/charts/constants';
|
|
45
43
|
import { colorFromDefaultPalette } from '../../../utils/charts/theme';
|
|
46
44
|
import { seriesHasAnnotations, isDataPointAnnotation } from '../../../utils/charts/utils';
|
|
47
|
-
import TooltipDefaultFormat from '../../shared_components/charts/tooltip_default_format.vue';
|
|
48
45
|
import Chart from '../chart/chart.vue';
|
|
49
46
|
import ChartLegend from '../legend/legend.vue';
|
|
50
47
|
import ChartTooltip from '../tooltip/tooltip.vue';
|
|
@@ -55,7 +52,6 @@ export default {
|
|
|
55
52
|
Chart,
|
|
56
53
|
ChartLegend,
|
|
57
54
|
ChartTooltip,
|
|
58
|
-
TooltipDefaultFormat,
|
|
59
55
|
},
|
|
60
56
|
inheritAttrs: false,
|
|
61
57
|
props: {
|
|
@@ -83,6 +79,12 @@ export default {
|
|
|
83
79
|
required: false,
|
|
84
80
|
default: true,
|
|
85
81
|
},
|
|
82
|
+
/**
|
|
83
|
+
* Callback called when showing or refreshing a tooltip.
|
|
84
|
+
* **Deprecated:** Use slots `#tooltip-title`, `#tooltip-content` or `#tooltip-value`.
|
|
85
|
+
*
|
|
86
|
+
* @deprecated Use slots `#tooltip-title`, `#tooltip-content` or `#tooltip-value`.
|
|
87
|
+
*/
|
|
86
88
|
formatTooltipText: {
|
|
87
89
|
type: Function,
|
|
88
90
|
required: false,
|
|
@@ -137,8 +139,6 @@ export default {
|
|
|
137
139
|
// https://gitlab.com/gitlab-org/gitlab-ui/-/issues/618
|
|
138
140
|
return {
|
|
139
141
|
chart: null,
|
|
140
|
-
dataTooltipTitle: '',
|
|
141
|
-
dataTooltipContent: {},
|
|
142
142
|
showAnnotationsTooltip: false,
|
|
143
143
|
annotationsTooltipTitle: '',
|
|
144
144
|
annotationsTooltipContent: '',
|
|
@@ -146,7 +146,6 @@ export default {
|
|
|
146
146
|
left: '0',
|
|
147
147
|
top: '0',
|
|
148
148
|
},
|
|
149
|
-
selectedFormatTooltipText: this.formatTooltipText || this.defaultFormatTooltipText,
|
|
150
149
|
};
|
|
151
150
|
},
|
|
152
151
|
computed: {
|
|
@@ -187,7 +186,7 @@ export default {
|
|
|
187
186
|
axisPointer: {
|
|
188
187
|
show: true,
|
|
189
188
|
label: {
|
|
190
|
-
formatter: this.
|
|
189
|
+
formatter: this.formatTooltipText,
|
|
191
190
|
},
|
|
192
191
|
},
|
|
193
192
|
axisTick: {
|
|
@@ -260,13 +259,6 @@ export default {
|
|
|
260
259
|
this.chart.off('mouseover', this.onChartDataPointMouseOver);
|
|
261
260
|
},
|
|
262
261
|
methods: {
|
|
263
|
-
defaultFormatTooltipText(params) {
|
|
264
|
-
// eslint-disable-next-line import/no-deprecated
|
|
265
|
-
const { xLabels, tooltipContent } = getDefaultTooltipContent(params, this.options.yAxis.name);
|
|
266
|
-
|
|
267
|
-
this.$set(this, 'dataTooltipContent', tooltipContent);
|
|
268
|
-
this.dataTooltipTitle = xLabels.join(', ');
|
|
269
|
-
},
|
|
270
262
|
defaultAnnotationTooltipText(params) {
|
|
271
263
|
return {
|
|
272
264
|
title: params.data.xAxis,
|
|
@@ -314,9 +306,6 @@ export default {
|
|
|
314
306
|
};
|
|
315
307
|
}
|
|
316
308
|
},
|
|
317
|
-
onLabelChange(params) {
|
|
318
|
-
this.selectedFormatTooltipText(params);
|
|
319
|
-
},
|
|
320
309
|
},
|
|
321
310
|
HEIGHT_AUTO_CLASSES,
|
|
322
311
|
};
|
|
@@ -347,21 +336,21 @@ export default {
|
|
|
347
336
|
</template>
|
|
348
337
|
<div>{{ annotationsTooltipContent }}</div>
|
|
349
338
|
</chart-tooltip>
|
|
350
|
-
<chart-tooltip
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
339
|
+
<chart-tooltip
|
|
340
|
+
v-if="chart"
|
|
341
|
+
ref="dataTooltip"
|
|
342
|
+
:chart="chart"
|
|
343
|
+
:use-default-tooltip-formatter="!formatTooltipText"
|
|
344
|
+
>
|
|
345
|
+
<template v-if="$scopedSlots['tooltip-title']" #title="scope">
|
|
346
|
+
<slot name="tooltip-title" v-bind="scope"></slot>
|
|
347
|
+
</template>
|
|
348
|
+
<template v-if="$scopedSlots['tooltip-content']" #default="scope">
|
|
349
|
+
<slot name="tooltip-content" v-bind="scope"></slot>
|
|
350
|
+
</template>
|
|
351
|
+
<template v-if="$scopedSlots['tooltip-value']" #tooltip-value="scope">
|
|
352
|
+
<slot name="tooltip-value" v-bind="scope"></slot>
|
|
357
353
|
</template>
|
|
358
|
-
<slot v-if="formatTooltipText" name="tooltip-content"></slot>
|
|
359
|
-
<tooltip-default-format v-else :tooltip-content="dataTooltipContent">
|
|
360
|
-
<template v-if="$scopedSlots['tooltip-value']" #tooltip-value="scope">
|
|
361
|
-
<!-- @slot Tooltip value formatter -->
|
|
362
|
-
<slot name="tooltip-value" v-bind="scope"></slot>
|
|
363
|
-
</template>
|
|
364
|
-
</tooltip-default-format>
|
|
365
354
|
</chart-tooltip>
|
|
366
355
|
<chart-legend
|
|
367
356
|
v-if="hasLegend"
|