Home forums Using CanvasJS Is it possible to pull the chart title from a CSV file?

Tagged: 

This topic contains 12 replies, has 2 voices, and was last updated by  ethicalsector 1 day, 8 hours ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #22492

    Hi, instead of entering the title as a text string, can it be pulled from a CSV?

    #22502

    Priyanka M S
    Member

    @ethicalsector,

    You can retrieve any chart options from CSV file.
    Please take a look at this jsfiddle.

    __
    Priyanka M S
    Team CanvasJS

    #22515

    Hi Priyanka, thanks for this example. I am trying to implement but I just get a blank screen when I try.
    I am unable to create a jsfiddle because when I try to pull the data from a CSV file I just get a blank screen.
    Is it possiblef for you to look at this bare-bones example to see how I can pull the chart title from the CSV?
    http://www.globalhungerindex.org/csv/csv.html

    #22519

    I’m also wondering if we can pull “exportFileName” from the CSV

    #22540

    Priyanka M S
    Member

    @ethicalsector,

    Please take a look at this jsfiddle.
    I have considered the first 9 countries from the CSV data you have provided and plotted the graph which renders according to the index that you provide manually var index = 9;. You can save the valid CSV data for the remaining countries in a file and run the same code. It should work fine for you.

    __
    Priyanka M S
    Team CanvasJS

    #22541

    Hi Priyanka,
    thanks for this, it’s great! But there’s just something strange happening with the X-axis. The four years are not being displayed correctly on the x-axis.

    #22553

    Priyanka M S
    Member

    @ethicalsector,

    Instead of parsing year as x value, parsing it as a label should work fine in your case.
    Please take look at this updated jsfiddle.

    __
    Priyanka M S
    Team CanvasJS

    #22561

    Perfect! Thanks very much for all your help!

    #22579

    Hi, I have a working demo of a more complicated multi-series spline and have tried to create a JSFiddle but I can’t get it to work, but this works perfectly as a webpage. Would you be able to take a look and see if you can understand? I am wondering how to do the same task as before – for the chart title, pull the country name from column 1 of the CSV – every fourth row as per the CSV. I tried the method you provided previously for the other chart but I can’t get it to work on this one. If I can provide any additional information, please just let me know: https://jsfiddle.net/w90ze7us/36/

    #22599

    Priyanka M S
    Member

    @ethicalsector,

    Please take a look at this updated jsfiddle.
    Also, I suggest you to have the country name in every record of CSV source, which will be easier to compare and retrieve the required country’s records among many records.
    __
    Priyanka M S
    Team CanvasJS

    #22668

    Hi, with this method, I still have to manually change the index so it’s just the same as manually typing the country name. It’s not really making anything more automated.

    #22669

    You haven’t used a CSV, you have used a JS.

    #22670

    Ah, sorry, now I understand, the index is the ONLY thing that needs to be changed in this method. That is better, thanks!

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

You must be logged in to reply to this topic.