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

Any working example for NUXT3 with polar charts? #268

Open
denpechen opened this issue Nov 28, 2024 · 0 comments
Open

Any working example for NUXT3 with polar charts? #268

denpechen opened this issue Nov 28, 2024 · 0 comments

Comments

@denpechen
Copy link

denpechen commented Nov 28, 2024

I cant solve problem with Polar chart.

Simple chart is working:

<template>
  <ClientOnly>
    <div ref="chartContainer"></div>
  </ClientOnly>
</template>

<script setup>
import { ref, onMounted } from "vue";

const chartContainer = ref(null);

onMounted(async () => {
  const Highcharts = await import("highcharts");

  Highcharts.default.chart(chartContainer.value, {
    title: {
      text: "Polar Chart",
    },
    pane: {
      startAngle: 0,
      endAngle: 360,
    },
    series: [
      {
        type: "line",
        name: "Data",
        data: [8, 12, 15, 10, 7, 8],
        pointPlacement: "on",
      },
    ],
    xAxis: {
      categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
      tickmarkPlacement: "on",
    },
    yAxis: {
      min: 0,
      title: {
        text: "Values",
      },
    },
  });
});
</script>

Polar chart:
[Vue warn]: Unhandled error during execution of mounted hook
Uncaught (in promise) TypeError: More is not a function

<template>
  <ClientOnly>
    <div ref="chartContainer"></div>
  </ClientOnly>
</template>

<script setup>
import { ref, onMounted } from "vue";

const chartContainer = ref(null);

onMounted(async () => {
  const Highcharts = await import("highcharts");
  const More = await import("highcharts/highcharts-more");

  More(Highcharts);

  Highcharts.default.chart(chartContainer.value, {
    chart: {
      polar: true,
    },
    title: {
      text: "Polar Chart",
    },
    pane: {
      startAngle: 0,
      endAngle: 360,
    },
    series: [
      {
        type: "line",
        name: "Data",
        data: [8, 12, 15, 10, 7, 8],
        pointPlacement: "on",
      },
    ],
    xAxis: {
      categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
      tickmarkPlacement: "on",
    },
    yAxis: {
      min: 0,
      title: {
        text: "Values",
      },
    },
  });
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant