I am trying to use props
value in dataPointSelection
in apexchart
under state but I am getting error that this.props
is undefined and also value not showing on console log. Here is my code that I did:
constructor(props) {
super(props);
const { t, too, fromm } = this.props;
console.log("Upper" + this.props.fromm);
this.state = {
...props,
options: {
chart: {
id: "Speeding",
events: {
dataPointSelection: function(event, chartContext, opts) {
switch (opts.w.config.xaxis.categories[opts.dataPointIndex]) {
case "0-10":
window.open(
window.location.origin +
`/overspeeding/10/0/${
this.props.too ? `${this.props.too}` : `${cc}`
}/${
this.props.fromm ? `${this.props.fromm}` : "2016-01-04"
}` // in this line i am getting error
);
How to resolve this error and user props value in event?