Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"zoomed" event not working #111

Open
egordanilenko opened this issue Jul 5, 2024 · 1 comment
Open

"zoomed" event not working #111

egordanilenko opened this issue Jul 5, 2024 · 1 comment

Comments

@egordanilenko
Copy link

"zoomed" event not firing when chart zoomed out or zoomed in

npm requirements:
"apexcharts": "^3.49.2",
"vue3-apexcharts": "^1.5.3",

Installed Versions:

├── [email protected]
├── [email protected]

Vue3 Component:

<script setup lang="ts">
import {ChartDateSeries} from "@/interface/ChartDateSeries";
import waterProbeService from "@/service/WaterProbeService";
import {AxiosResponse} from "axios";
import {WaterProbeInterface} from "@/interface/WaterProbeInterface";


const options:ApexCharts.ApexOptions = {
  tooltip: {
    x: {
      show: true,
      format: 'dd MMM yyyy HH:mm'
    },
    y: {
      formatter: undefined,
      title: {
        formatter: (seriesName: any) => `${seriesName}`
      }
    }
  },
  chart:{
    events:{
      zoomed: function (chart, options){console.log('zoom from opts')}
    }
  },
  xaxis: {
    type: 'datetime',
    labels: {
      datetimeUTC: false
    }
  }
  }
;
const series = ref<ChartDateSeries[]>([]);

function  load(){
  waterProbeService.graph({}).then((response: AxiosResponse)=>{
    const graph:ChartDateSeries = {name: "Pressure", data:[]}
    series.value.push(graph);
    response.data.map((item:WaterProbeInterface)=>{
      const x:Date = new Date(item.dateTime *1000);
      graph.data.push({x: x, y: Math.floor(item.data.pressure * 10)/10})
    })
  });

}
load()

</script>

<template>
  <apexchart height="200px" type="line" :options="options" :series="series"></apexchart>
</template>

<style scoped lang="sass">

</style>

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant