TargetProcess / tauCharts

D3 based data-focused charting library. Designed with passion. Flexible.
https://www.taucharts.com
Other
1.91k stars 118 forks source link

"tauCharts is not defined" error message #596

Closed irocmon closed 3 years ago

irocmon commented 3 years ago

This is an issue that I have been working on for a few days and finally found the solution. Thought I would post it here in case anyone else runs across this issue to save them the headache i just went through.

Our charts stopped working and we started getting this error message. "tauCharts is not defined" The code hasn't been touched in 4 years, so I figured it had something to do with the libraries.

I was able to fix it by upgrading from 0.5.0 to 2.8.0, changing "tauCharts" to "Taucharts" everywhere it existed (This is what took me soooooo long to figure out) and changing d3 to version 5. (Not sure the best version here, but it worked for me)

Example...

html

    <script src="//d3js.org/d3.v5.min.js"></script>
    <script src="//cdn.jsdelivr.net/npm/taucharts@2.8.0/dist/taucharts.min.js" type="text/javascript"></script>

javascript

    tauChartConfig.plugins = [
      Taucharts.api.plugins.get('trendline')(),
      Taucharts.api.plugins.get('legend')()
    ];
    var tauChart = new Taucharts.Chart(tauChartConfig);
    tauChart.renderTo('#chartjs'+chartId + ' .panel-body div');
  }

Just wanted to save someone the effort since the docs aren't working. Also I found the name change by noticing the difference in the Readme file. So reference that as well.

Mavrin commented 3 years ago

Thank you for your remark. In previous readme we have //cdn.jsdelivr.net/taucharts/latest/taucharts.min.js and it was mistake. We shouldn't use latest version in readme. Also we have migration guide to v2 version https://github.com/TargetProcess/tauCharts#migrating-from-taucharts-v1-to-v2 Taucharts@2 is compatible with D3 v4 and v5. Sorry for the inconvenience.