0

This is the first time i am trying to make an stackblitz app with Angular6, Primeng 6 . I am trying to create Primeng chart with it. I installed Chartjs and also updated the angular.json file, as given in Primeng documentation but it is throwing error saying Chart is not defined. Can anyone help me to resolve this issue. Same thing is working perfectly in my local setup.

Here is the link: stackblitz link

DirtyMind
  • 2,353
  • 2
  • 22
  • 43

1 Answers1

1

Placing these two script lines in the index.html file allows it to run natively in stackblitz.

<script src="https://github.com/chartjs/Chart.js/releases/download/v2.7.2/Chart.bundle.min.js"></script>
  <script src="https://github.com/chartjs/chartjs-plugin-datalabels/releases/download/v0.4.0/chartjs-plugin-datalabels.min.js"></script>
Marshal
  • 10,499
  • 2
  • 34
  • 53
  • Yeah !! it is working...But I want to run it in Primeng way..because I need to replicate a scenario which uses two different plugins of Chart js. Individually they are working but if i am using both then it is not working as expected. So I am not sure how to add plugin in stackblitz...do you have any Idea how I can add this plugin in Stackblitz. [chartjs datalabels](https://github.com/chartjs/chartjs-plugin-datalabels) – DirtyMind Oct 12 '18 at 21:51
  • Ok think I have it sorted. Please see the two script tags to get it to run correctly. – Marshal Oct 12 '18 at 23:10
  • Perfect It is working now. I can see the changes of chartjs Datalabels :) thanks – DirtyMind Oct 13 '18 at 07:44
  • As you have been so helpful...One last thing how to add [chartjs-funnel](https://www.npmjs.com/package/chartjs-plugin-funnel/v/1.1.2) not able to find script so that I can add it in index.html. Or do you know any other way? This is the last plugin I wanted to add to replicate the issue. I can raise a new question If you want. – DirtyMind Oct 13 '18 at 07:53
  • Sorry for delay, if you don't mind please raise a new question and I will post. – Marshal Oct 13 '18 at 14:19
  • Added question here : [question added](https://stackoverflow.com/questions/52796726/how-to-add-chartjs-plugin-funnel-plugin-in-stackblitz) – DirtyMind Oct 13 '18 at 19:49