|
196 | 196 | </defs> |
197 | 197 | </template> |
198 | 198 |
|
199 | | - <!-- HIGHLIGHT AREA --> |
200 | | - <g v-for="oneArea in highlightAreas"> |
| 199 | + <!-- HIGHLIGHT AREA RECT FILLS --> |
| 200 | + <g v-for="oneArea in highlightAreas"> |
201 | 201 | <template v-if="oneArea.show"> |
202 | 202 | <rect |
203 | 203 | data-cy="xy-highlight-area" |
|
222 | 222 | </template> |
223 | 223 | </g> |
224 | 224 |
|
| 225 | + <!-- HIGHLIGHTERS --> |
| 226 | + <g> |
| 227 | + <g v-for="(_, i) in maxSeries" :key="`tooltip_trap_${i}`"> |
| 228 | + <rect |
| 229 | + :data-cy="`xy-tooltip-trap-${i}`" |
| 230 | + data-cy-trap |
| 231 | + :x="drawingArea.left + (drawingArea.width / maxSeries) * i" |
| 232 | + :y="drawingArea.top" |
| 233 | + :height="drawingArea.height < 0 ? 10 : drawingArea.height" |
| 234 | + :width="drawingArea.width / maxSeries < 0 ? 0.00001 : drawingArea.width / maxSeries" |
| 235 | + :fill="selectedSerieIndex === i || selectedRowIndex === i ? `${FINAL_CONFIG.chart.highlighter.color}${opacity[FINAL_CONFIG.chart.highlighter.opacity]}` : 'transparent'" |
| 236 | + /> |
| 237 | + </g> |
| 238 | + </g> |
| 239 | + |
225 | 240 | <!-- BARS --> |
226 | 241 | <template v-if="barSet.length"> |
227 | 242 | <g v-for="(serie, i) in barSet" :key="`serie_bar_${i}`" :class="`serie_bar_${i}`" :style="`opacity:${selectedScale ? selectedScale === serie.id ? 1 : 0.2 : 1};transition:opacity 0.2s ease-in-out`"> |
|
302 | 317 | /> |
303 | 318 | </template> |
304 | 319 |
|
| 320 | + <g v-if="FINAL_CONFIG.chart.highlighter.useLine && ![null, undefined].includes(selectedSerieIndex)"> |
| 321 | + <line |
| 322 | + :x1="drawingArea.left + (drawingArea.width / maxSeries) * selectedSerieIndex + (drawingArea.width / maxSeries / 2)" |
| 323 | + :x2="drawingArea.left + (drawingArea.width / maxSeries) * selectedSerieIndex + (drawingArea.width / maxSeries / 2)" |
| 324 | + :y1="drawingArea.top" |
| 325 | + :y2="drawingArea.bottom" |
| 326 | + :stroke="FINAL_CONFIG.chart.highlighter.color" |
| 327 | + :stroke-width="FINAL_CONFIG.chart.highlighter.lineWidth" |
| 328 | + :stroke-dasharray="FINAL_CONFIG.chart.highlighter.lineDasharray" |
| 329 | + stroke-linecap="round" |
| 330 | + style="transition:none !important; animation: none !important; pointer-events: none;" |
| 331 | + /> |
| 332 | + </g> |
| 333 | + |
305 | 334 | <!-- LEFT & RIGHT PADDING COVERS --> |
306 | 335 | <g> |
307 | 336 | <rect |
|
336 | 365 | :stroke-dasharray="FINAL_CONFIG.chart.grid.frame.strokeDasharray" |
337 | 366 | /> |
338 | 367 |
|
339 | | - <!-- Y LABELS --> |
340 | | - <g v-if="FINAL_CONFIG.chart.grid.labels.show"> |
| 368 | + <!-- Y LABELS --> |
| 369 | + <g v-if="FINAL_CONFIG.chart.grid.labels.show"> |
341 | 370 | <template v-if="mutableConfig.useIndividualScale"> |
342 | 371 | <g v-for="el in allScales"> |
343 | 372 | <line |
|
931 | 960 | :y="drawingArea.top" |
932 | 961 | :height="drawingArea.height < 0 ? 10 : drawingArea.height" |
933 | 962 | :width="drawingArea.width / maxSeries < 0 ? 0.00001 : drawingArea.width / maxSeries" |
934 | | - :fill="selectedSerieIndex === i || selectedRowIndex === i ? `${FINAL_CONFIG.chart.highlighter.color}${opacity[FINAL_CONFIG.chart.highlighter.opacity]}` : 'transparent'" |
| 963 | + fill="transparent" |
935 | 964 | @mouseenter="toggleTooltipVisibility(true, i)" |
936 | 965 | @mouseleave="toggleTooltipVisibility(false)" |
937 | 966 | @click="selectX(i)" |
938 | 967 | /> |
939 | 968 | </g> |
940 | 969 | </g> |
941 | 970 |
|
942 | | - <g v-if="FINAL_CONFIG.chart.highlighter.useLine && ![null, undefined].includes(selectedSerieIndex)"> |
943 | | - <line |
944 | | - :x1="drawingArea.left + (drawingArea.width / maxSeries) * selectedSerieIndex + (drawingArea.width / maxSeries / 2)" |
945 | | - :x2="drawingArea.left + (drawingArea.width / maxSeries) * selectedSerieIndex + (drawingArea.width / maxSeries / 2)" |
946 | | - :y1="drawingArea.top" |
947 | | - :y2="drawingArea.bottom" |
948 | | - :stroke="FINAL_CONFIG.chart.highlighter.color" |
949 | | - :stroke-width="FINAL_CONFIG.chart.highlighter.lineWidth" |
950 | | - :stroke-dasharray="FINAL_CONFIG.chart.highlighter.lineDasharray" |
951 | | - stroke-linecap="round" |
952 | | - style="transition:none !important; animation: none !important; pointer-events: none;" |
953 | | - /> |
954 | | - </g> |
955 | | - |
956 | 971 | <!-- TIME TAG --> |
957 | 972 | <g v-if="FINAL_CONFIG.chart.timeTag.show && ![null, undefined].includes(selectedSerieIndex)"> |
958 | 973 | <foreignObject |
@@ -1156,6 +1171,7 @@ import { |
1156 | 1171 | dataLabel, |
1157 | 1172 | downloadCsv, |
1158 | 1173 | functionReturnsString, |
| 1174 | + hasDeepProperty, |
1159 | 1175 | isFunction, |
1160 | 1176 | isSafeValue, |
1161 | 1177 | opacity, |
@@ -1386,13 +1402,29 @@ export default { |
1386 | 1402 | defaultConfig: DEFAULT_CONFIG |
1387 | 1403 | }); |
1388 | 1404 |
|
1389 | | - if ('highlightArea' in this.config.chart) { |
| 1405 | + // ------------------------------ OVERRIDES ----------------------------------- |
| 1406 | +
|
| 1407 | + if (this.config && this.hasDeepProperty(this.config, 'chart.highlightArea')) { |
1390 | 1408 | if (!Array.isArray(this.config.chart.highlightArea)) { |
1391 | 1409 | mergedConfig.chart.highlightArea = [this.config.chart.highlightArea] // FIXME: should be sanitized using useNestedPropToo |
1392 | 1410 | } else { |
1393 | | - mergedConfig.chart.highlightArea = this.config.chart.highlightArea; // |
| 1411 | + mergedConfig.chart.highlightArea = this.config.chart.highlightArea; |
1394 | 1412 | } |
1395 | 1413 | } |
| 1414 | + |
| 1415 | + if (this.config && this.hasDeepProperty(this.config, 'chart.grid.labels.yAxis.scaleMin')) { |
| 1416 | + mergedConfig.chart.grid.labels.yAxis.scaleMin = this.config.chart.grid.labels.yAxis.scaleMin; |
| 1417 | + } else { |
| 1418 | + mergedConfig.chart.grid.labels.yAxis.scaleMin = null; |
| 1419 | + } |
| 1420 | + |
| 1421 | + if (this.config && this.hasDeepProperty(this.config, 'chart.grid.labels.yAxis.scaleMax')) { |
| 1422 | + mergedConfig.chart.grid.labels.yAxis.scaleMax = this.config.chart.grid.labels.yAxis.scaleMax; |
| 1423 | + } else { |
| 1424 | + mergedConfig.chart.grid.labels.yAxis.scaleMax = null; |
| 1425 | + } |
| 1426 | + |
| 1427 | + // ---------------------------------------------------------------------------- |
1396 | 1428 |
|
1397 | 1429 | if (mergedConfig.theme) { |
1398 | 1430 | return { |
@@ -1838,9 +1870,16 @@ export default { |
1838 | 1870 | } |
1839 | 1871 | }, |
1840 | 1872 | max(){ |
| 1873 | + if (this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMax) { |
| 1874 | + return this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMax |
| 1875 | + } |
1841 | 1876 | return Math.max(...this.safeDataset.filter(s => !this.segregatedSeries.includes(s.id)).map(datapoint => Math.max(...datapoint.series))); |
1842 | 1877 | }, |
1843 | 1878 | min() { |
| 1879 | + console.log(this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin === null) |
| 1880 | + if (this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin !== null) { |
| 1881 | + return this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin |
| 1882 | + } |
1844 | 1883 | const min = Math.min(...this.safeDataset.filter(s => !this.segregatedSeries.includes(s.id)).map(datapoint => Math.min(...datapoint.series))); |
1845 | 1884 | if(min > 0) return 0; |
1846 | 1885 | return min; |
@@ -2198,33 +2237,34 @@ export default { |
2198 | 2237 | }, |
2199 | 2238 | methods: { |
2200 | 2239 | abbreviate, |
2201 | | - assignStackRatios, |
| 2240 | + adaptColorToBackground, |
2202 | 2241 | applyDataLabel, |
| 2242 | + assignStackRatios, |
| 2243 | + calcLinearProgression, |
2203 | 2244 | calculateNiceScaleWithExactExtremes, |
2204 | 2245 | checkNaN, |
2205 | | - createSmoothPath, |
2206 | | - isSafeValue, |
2207 | | - treeShake, |
2208 | | - shiftHue, |
2209 | | - pdf, |
2210 | | - img, |
| 2246 | + closestDecimal, |
2211 | 2247 | convertColorToHex, |
2212 | 2248 | convertConfigColors, |
2213 | 2249 | convertCustomPalette, |
2214 | | - downloadCsv, |
2215 | 2250 | createCsvContent, |
2216 | | - adaptColorToBackground, |
2217 | | - calcLinearProgression, |
2218 | | - useMouse, |
2219 | | - closestDecimal, |
| 2251 | + createSmoothPath, |
| 2252 | + createTSpans, |
2220 | 2253 | dataLabel, |
2221 | | - isFunction, |
2222 | | - functionReturnsString, |
| 2254 | + downloadCsv, |
2223 | 2255 | error, |
| 2256 | + functionReturnsString, |
| 2257 | + hasDeepProperty, |
| 2258 | + img, |
| 2259 | + isFunction, |
| 2260 | + isSafeValue, |
2224 | 2261 | objectIsEmpty, |
2225 | | - createTSpans, |
2226 | | - useNestedProp, |
| 2262 | + pdf, |
| 2263 | + shiftHue, |
2227 | 2264 | translateSize, |
| 2265 | + treeShake, |
| 2266 | + useMouse, |
| 2267 | + useNestedProp, |
2228 | 2268 | convertSizes() { |
2229 | 2269 | // Adaptative sizes in responsive mode |
2230 | 2270 | this.fontSizes.dataLabels = this.translateSize({ |
|
0 commit comments