WordPress.org

Ready to get started?Download WordPress

Forums

IPU-Chart
[resolved] Error "There was an error loading the data: csv" (6 posts)

  1. Kwayy Infotech
    Member
    Posted 1 year ago #

    Hello,

    I am using first sample code from http://wordpress.org/extend/plugins/ipu-chart/

    But I am getting error:
    There was an error loading the data: csv

    Also I am getting error in Console:
    There was an error loading the data: [object XMLHttpRequest]

    I am not sure how to solve this. I tried other examples but still getting same error.

  2. thmufl
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    Looks like the plugin tries to load a remote csv file. Did you enter a # before the id in the csv attribute of the chart?

    I can verify this if you set the debug attribute of the chart to 'true' and post the console log.

  3. Kwayy Infotech
    Member
    Posted 1 year ago #

    Thanks for quick reply.

    I enabled debug and now I am getting these details in Console:

    CLIENT:
    	user-agent: mozilla/5.0 (x11; linux i686) applewebkit/537.31 (khtml, like gecko) chrome/26.0.1410.63 safari/537.31
    	touch device: false
    	SVG support: true
    	screen width/height: 1600px/900px
    PLUGIN:
    	IPU-Chart, Version 0.4
    CALL RENDER CHART:
    	id: chart907205
    	csv: csv
    	type: bar
    	category: name
    	value: value
    	format: %s,%f
    	color: auto
    	style: width:100%;height:300px;
    	title: Set a title
    	description: Set a description
    	sort: none
    	interpolate: linear
    	animate: none
    	img:
    	debug: true
    There was an error loading the data: [object XMLHttpRequest]

    Here is the code I pasted on the page:

    [csv id="data"]
    Country,Population
    China,1343.24
    India,1205.07
    USA,313.85
    Indonesia,248.22
    Brazil,205.72
    [/csv]
    
    [chart csv="#data"
           type="bar"
           category="Country"
           value="Population"
           format="string,float"
           color="auto"
           title="Top five most populous countries of the world..."
           description="The top five most populous countries of the world..."
           sort="Population"
           animate="medium"
           img="https://www.ipublia.com/wp-content/uploads/chart-x1.png"
           debug="true"]
  4. Kwayy Infotech
    Member
    Posted 1 year ago #

    I got it working.
    the chart shortcode content should be in one line. So I write this code in page content area:

    [csv id="data1"]
    Country,Population
    China,1343.24
    India,1205.07
    USA,313.85
    Indonesia,248.22
    Brazil,205.72
    [/csv]
    [chart csv="#data1" type="bar" category="Country" value="Population" format="string,float" color="auto" title="Top five most populous countries of the world..." description="The top five most populous countries of the world..." sort="Population" animate="medium" img="https://www.ipublia.com/wp-content/uploads/chart-x1.png" debug="true"]

    And the chart is working.

    I think you need to update your example shortcode.

  5. thmufl
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks!

    The linefeeds in the documentation are for legibility. Please enter the data like this:

    [csv id='data']Country,Population
    China,1343.24
    India,1205.07
    USA,313.85
    Indonesia,248.22
    Brazil,205.72[/csv]

    And remove the linefeeds between the attributes like:

    [chart csv="#data" type="bar" category="Country" ...]

    Don't forget the # to reference the csv data (from the log it seems that it is missing). It indicates that the data is local (vs remote by url).

  6. thmufl
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, I'll clarify this. I voted for legibility of the code... but it's confusing.

    Thanks for the helpful feedback! Hope you enjoy the plugin.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.