Here is a jsfiddle with your code that shows it working: https://jsfiddle.net/dlaliberte/4n6jvt3x/
There are a couple points to be careful of. * You need to make sure the loader is finished loading before you make any call to google.charts or google.visualization functions. Doing the load in a script tag before you use it should generally work, but I notice you load Plot.js first, which may fail if you have any top-level calls to google functions, or maybe it is failing to load for some other reason. Calling the google functions in the same script as your drawChart function will ensure both are defined and used at the same time. (Be sure to spell it correctly, as well.. "drawchart" vs "drawChart"). * Also make sure your div is defined before you use it in your drawChart function. You should see a console error if you don't, however. * The jsfiddle is little picky and non-obvious about how it generates a web page. Note that the js block uses the "No wrap - bottom of <body>" option. Hope that helps. On Tue, Sep 3, 2019 at 10:55 AM Martin Noyes <[email protected]> wrote: > > > On Tuesday, September 3, 2019 at 10:27:54 AM UTC-4, Daniel LaLiberte wrote: >> >> The problem could very well be in your drawchart function, so it would >> help to see the relevant parts. If you could reproduce the problem you are >> seeing in jsfiddle, or similar, that would help make it very clear what is >> happening. >> >> The drawchart function is vanilla straight out of Line Chart example: > function drawChart() { > var data = google.visualization.arrayToDataTable([ > ['Year', 'Sales', 'Expenses'], > ['2004', 1000, 400], > ['2005', 1170, 460], > ['2006', 660, 1120], > ['2007', 1030, 540] > ]); > > var options = { > title: 'Company Performance', > curveType: 'function', > legend: { position: 'bottom' } > }; > > var chart = new > google.visualization.LineChart(document.getElementById('curve_chart')); > > chart.draw(data, options); > } > > The html div is: > > <div id="curve_chart"/> > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-visualization-api/51d8680a-e37d-4f4e-aeac-418590fcf99b%40googlegroups.com > <https://groups.google.com/d/msgid/google-visualization-api/51d8680a-e37d-4f4e-aeac-418590fcf99b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> [email protected] <[email protected]> Cambridge MA -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJN%2BAJVQ%3D68BXyMHk4%3DhixZ%2BY8-LhhHbqw-u8PoUgUy7FQ%40mail.gmail.com.
