jtblin / angular-chart.js

Reactive, responsive, beautiful charts for AngularJS using Chart.js: http://jtblin.github.io/angular-chart.js
Other
2.67k stars 759 forks source link

Outdated library... just use Charts.js instead #677

Open MileanCo opened 6 years ago

MileanCo commented 6 years ago

Dont mean to complain here, but this convenience library seems a bit outdated. A lot of the documentation here http://www.chartjs.org/docs/latest/ doesnt seem to apply to this library. I wanted to change the Tooltip to hover and show constantly the closest point. However, using the Tooltip docs just made the tooltip completely stop working.

Instead, I just used Charts.js straight away (with Angular) and it worked great. No "angular-charts.js" needed....

JesTen commented 6 years ago

I'm having the exact same problem. @MileanCo would you like to share how you implemented Chart.js without Angular Chart?

MileanCo commented 6 years ago

@JesTen in my "index.html" I added this: <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.bundle.min.js"></script>

Then in my view.html file (or whatever yours is called): <canvas id="myChart" ></canvas>

Then in the Angular controller:
  function createChart() {
      var ctx = document.getElementById("myChart").getContext('2d');
      if ($scope.lineChart) {
        $scope.lineChart.destroy();
      }
      $scope.lineChart = new Chart(ctx, {
          type: 'line',
          data: {
              labels: ["Stuff"],
              datasets: [{
                  label: '# of Stuff',
                  yAxisID: 'num_stuff',
                  data: $scope.chart.stuff_data,
                  borderWidth: 2
              }]
          },
          options : {
            scales: {
              xAxes: [{
                  type: 'time',
                  time: {
                      displayFormats: {
                          quarter: 'MMM YYYY'
                      },
                      min:0,
                  }
              }],
            },
          }
      });
      $scope.$apply();
    }

Make sure you read the code and update the appropriate areas, namely the "stuff" variables. And read the documentation

mcelotti commented 6 years ago

Hi MileanCo, I think we should take a look at chart.js 2.3.x docs here: https://github.com/chartjs/Chart.js/tree/v2.3.0/docs Those docs are the right ones for the current version used by angular-chart.js, I'm just guessing...

aegrey commented 6 years ago

Lots of PRs are open and the last one merged on Aug 27th, 2017. Looks like there's a lot of updates in queue, and I know this library is still used often and many of us would love to see it continued to be maintained, and upgraded to Chart.js 2.5 (only 3 easy breaking changes) and even 2.7. I'm working on a large SaaS that it's very integrated into, which a bower install for newer libraries caused a breaking change, so I've modified it on my own. @jtblin you've built a great and very useful module, and while AngularJS is not the newest framework, many apps still use it and will continue to do so for a while. If you are no longer able to maintain, myself and I'm sure others who've been active contributors would be happy to continue with a fork if you'd endorse, or If you'd be open to another dev to help review/merge of PRs, I'm sure many frequent contributors who you worked with would be willing to do so as well.