Jump to content

c3js Uncaught ReferenceError: chart is not defined

So I have a few charts on my page and I'm trying to update them using the flow function

 

http://c3js.org/samples/api_flow.html

 

but I get Uncaught ReferenceError: chart is not defined

 

My code

 

chart.flow({
	bindto: '#test',
        columns: [
            ['data1', 230, 300, 330],
            ['data2', 190, 230, 200],
            ['data3', 90, 130, 180],
        ],
        duration: 1500
    });

What's wrong?

Back-end developer, electronics "hacker"

Link to post
Share on other sites

16 hours ago, Joveice said:

So I have a few charts on my page and I'm trying to update them using the flow function

 

http://c3js.org/samples/api_flow.html

 

but I get Uncaught ReferenceError: chart is not defined

 

My code

 


chart.flow({
	bindto: '#test',
        columns: [
            ['data1', 230, 300, 330],
            ['data2', 190, 230, 200],
            ['data3', 90, 130, 180],
        ],
        duration: 1500
    });

What's wrong?

Simply said, the variable chart has not been defined! So you call flow on undefined.

Business Management Student @ University St. Gallen (Switzerland)

HomeServer: i7 4930k - GTX 1070ti - ASUS Rampage IV Gene - 32Gb Ram

Laptop: MacBook Pro Retina 15" 2018

Operating Systems (Virtualised using VMware): Windows Pro 10, Cent OS 7

Occupation: Software Engineer

Link to post
Share on other sites

On 28.5.2017 at 10:13 AM, leodaniel said:

Simply said, the variable chart has not been defined! So you call flow on undefined.

Yea thats the issue, I don't know what to fix as It's just a copy of a working version :P

Back-end developer, electronics "hacker"

Link to post
Share on other sites

19 minutes ago, Joveice said:

Yea thats the issue, I don't know what to fix as It's just a copy of a working version :P

You are just referring the variable chart, but it has never been declared or anything! I am not common with the library you use, but check their documentation! 

/* Maybe it will be somthing like this */
var chart = new ChartJS({
    key:value
});

 

Business Management Student @ University St. Gallen (Switzerland)

HomeServer: i7 4930k - GTX 1070ti - ASUS Rampage IV Gene - 32Gb Ram

Laptop: MacBook Pro Retina 15" 2018

Operating Systems (Virtualised using VMware): Windows Pro 10, Cent OS 7

Occupation: Software Engineer

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×