You must be logged in to post your query.
Home › Forums › Chart Support › Is it possible to pull the chart title from a CSV file?
Tagged: csv
Hi, instead of entering the title as a text string, can it be pulled from a CSV?
@ethicalsector,
You can retrieve any chart options from CSV file. Please take a look at this jsfiddle.
__ Priyanka M S Team CanvasJS
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
I’m also wondering if we can pull “exportFileName” from the CSV
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.
var index = 9;
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.
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.
Perfect! Thanks very much for all your help!
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/
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
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.
You haven’t used a CSV, you have used a JS.
Ah, sorry, now I understand, the index is the ONLY thing that needs to be changed in this method. That is better, thanks!
Is it possible to display integers with no decimal point as X.0 in this jsfiddle? https://jsfiddle.net/canvasjs/w90ze7us/40/
If you like to show y-value without decimal point in toolTip and indexLabel, you can use yValueFormatString. Please take a look at this updated JSFiddle.
At the same time, to format x-value displayed in toolTip and indexLabel, you can set xValueFormatString according to your requirements and to format axis-labels, you can use valueFormatString.
— Vishwas R Team CanvasJS
You must be logged in to reply to this topic. Login/Register