Hello,
I managed to create a brush chart using Apex Charts in Perspective but when I open my view containing this chart, the default selection I set (min and max) is not selected by default. I have to do a manual selection on the chart used for date range.
Here is the chart option parameters i use :
{
"brush": {
"enabled": true,
"target": "chart1"
},
"dropShadow": {
"blur": 10,
"color": "#000",
"enabled": false,
"left": 7,
"opacity": 0.2,
"top": 18
},
"events": {
"animationEnd": false,
"beforeMount": false,
"beforeResetZoom": false,
"beforeZoom": false,
"brushScrolled": false,
"click": false,
"dataPointMouseEnter": false,
"dataPointMouseLeave": false,
"dataPointSelection": false,
"legendClick": false,
"markerClick": false,
"mounted": false,
"mouseLeave": false,
"mouseMove": false,
"scrolled": false,
"selection": false,
"updated": false,
"zoomed": false
},
"height": 350,
"selection": {
"enabled": true,
"fill": {
"color": "#24292e",
"opacity": "0.2"
},
"range": 1,
"type": "x",
"xaxis": {
"min": "new Date(\u002705 Apr 2023\u0027).getTime()",
"max": "new Date(\u002708 Apr 2023\u0027).getTime()"
}
},
"toolbar": {
"autoSelected": "selection",
"show": false
},
"type": "area"
}
I can't figure out how to set the min and max selection so that when i open my view, the range is already selected like in this example :
https://apexcharts.com/javascript-chart-demos/line-charts/brush-chart/
Edit :
I found the solution which was to activate the mounted event and set a script that would write min and max date on the Mounted Event on the chart.