How to install and use Chart.js in Vue.js 3

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

ความคิดเห็น • 24

  • @Mr.Rojer.
    @Mr.Rojer. 2 หลายเดือนก่อน

    Very helpful and simple. Thanks a lot!

  • @guestofallah7661
    @guestofallah7661 2 ปีที่แล้ว +3

    Dude u was struggling for hours to make it work with vue , thank you !

  • @aidenpeace1997
    @aidenpeace1997 9 หลายเดือนก่อน

    Awsome video, thank you for sharing this information!

  • @eddierick4756
    @eddierick4756 10 หลายเดือนก่อน

    Really work for me, thanks a lot bro

  • @sachawicky
    @sachawicky 2 ปีที่แล้ว +1

    Thank you, you literary saved me for my assignment

  • @muenzi01
    @muenzi01 ปีที่แล้ว

    thank you very much

  • @amirtorabi3978
    @amirtorabi3978 2 ปีที่แล้ว

    It should be amazing if a full video about chart js create

    • @SimonSuh
      @SimonSuh  2 ปีที่แล้ว

      There's already a ton of videos that goes into detail on Chart.js - check out this channel - th-cam.com/users/ChartJS-tutorials - implementing it in vue.js is basically the same once you have the chart.js vue npm package installed.

  • @vishalshrivastav179
    @vishalshrivastav179 2 ปีที่แล้ว

    great work sir . I loved you video

  • @BenAssane
    @BenAssane 2 ปีที่แล้ว +1

    Great content !
    I subscribed

    • @SimonSuh
      @SimonSuh  2 ปีที่แล้ว

      Thanks! :)

  • @MahbuburRahman-uc7np
    @MahbuburRahman-uc7np 2 ปีที่แล้ว

    Any idea how to use the onClick callback to find which point was clicked upon on the chart. I am using . onClick only returns the actual x and y value of the canvas but not the data point

  • @animaline
    @animaline 2 ปีที่แล้ว +1

    Hey SImon, could you show us how to do this but while using an API we created?

    • @SimonSuh
      @SimonSuh  2 ปีที่แล้ว +1

      I'm preparing a tutorial on using a stock price history lookup api to use with Chart.js. Or do you mean creating an api from scratch too? lol

    • @animaline
      @animaline 2 ปีที่แล้ว

      @@SimonSuh stock price is a great option !

    • @SimonSuh
      @SimonSuh  2 ปีที่แล้ว +1

      @@animaline I'll be creating the video tutorial soon, but I have finished the code where you're able to look up stock symbols and show a 1 year 5 year and 1 month price history chart using chart.js. Code is here if you want to take a look - github.com/simonjsuh/practice9-stock-price-history-app/tree/Stock-Lookup-Code-Complete-(Before-TH-cam-Tutorial)

    • @animaline
      @animaline 2 ปีที่แล้ว

      @@SimonSuh weird, I get a 404

    • @SimonSuh
      @SimonSuh  2 ปีที่แล้ว +1

      oops, I had repository to private. I changed it to public, you should be able to access it now.

  •  ปีที่แล้ว

    Anyway to use with setup script?

  • @NASAOrbit45
    @NASAOrbit45 2 ปีที่แล้ว

    HI @simon Suh,
    I am geting an error when I am using composition Api using Vue 3.
    TypeError: Cannot read properties of null (reading 'getContext')
    import { onMounted } from "vue";
    import Chart from "chart.js/auto";
    const canvas = document.getElementById("canvas");
    const ctx = canvas.getContext("2d");
    onMounted(() => {
    const myChart = new Chart(ctx, {
    type: "bar",
    data: {
    labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
    datasets: [
    {
    label: "# of Votes",
    data: [12, 19, 3, 5, 2, 3],
    backgroundColor: [
    "rgba(255, 99, 132, 0.2)",
    "rgba(54, 162, 235, 0.2)",
    "rgba(255, 206, 86, 0.2)",
    "rgba(75, 192, 192, 0.2)",
    "rgba(153, 102, 255, 0.2)",
    "rgba(255, 159, 64, 0.2)",
    ],
    borderColor: [
    "rgba(255, 99, 132, 1)",
    "rgba(54, 162, 235, 1)",
    "rgba(255, 206, 86, 1)",
    "rgba(75, 192, 192, 1)",
    "rgba(153, 102, 255, 1)",
    "rgba(255, 159, 64, 1)",
    ],
    borderWidth: 1,
    },
    ],
    },
    options: {
    scales: {
    y: {
    beginAtZero: true,
    },
    },
    },
    });
    myChart;
    });

    • @nikhils7583
      @nikhils7583 ปีที่แล้ว

      did you get it?

    • @NASAOrbit45
      @NASAOrbit45 9 หลายเดือนก่อน

      ​@@nikhils7583 Yes! I got it