Home Forums Chart Support Can't create chart from external api link

Can't create chart from external api link

Viewing 4 posts - 1 through 4 (of 4 total)
  • #24030

    Hello everyone!
    This is my first time with CanvasJs.
    I’m trying to create a chart from my local api link.
    Here is my code:

      type: 'GET',
      url: 'http://localhost:8083/json',
      dataType: 'json',
      success(data) {
        new CanvasJS.Chart("chartContainer", {
          title: {
            text: "User Count"
          data: [{
            type: "column",
            dataPoints: data.map(
              ({ userId, numberOfusers }) => ({ label: userId, y: numberOfusers })
    <script src="https://cdnjs.cloudflare.com/ajax/libs/canvasjs/1.7.0/canvasjs.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <div id="chartContainer" style="height: 360px; width: 100%;"></div>

    But it return white page. Can someone help me? Thank you very much!



    Can you kindly share a sample project with sample JSON data over google-drive or onedrive so that we can understand it better and help you out?

    Indranil Deo,
    Team CanvasJS


    Thanks for your reply! I fixed.
    I need to allow origin for my server side. Then I can use localhost api link to create chart.



    Glad you figured out the issue.

    Indranil Deo,
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.