Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了angularjs – 使用Charts.js在Angular Chart中不显示系列详细信息大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在我的离子应用程序中实现Angular Line Chart功能,如链接 https://jtblin.github.io/angular-chart.js/中所述

图表显示成功,但不显示图表下方的系列详细信息(含义哪种颜色代表哪条线)

我正在通过图表系列字段,但仍未显示.
好心提醒.

这是
的index.html

<ion-content ng-controller="ExampleCtrl">
     <div class="card">
        <div class="item item-divider">
          This is a Line Chart
        </div>
        <div class="item item-text-wrap">
          <canvas id="line" class="chart chart-line" chart-data="data" chart-labels="labels" chart-series="series" chart-options="options" chart-legend="true"
          chart-dataset-override="datasetOverride" chart-click="onClick"> 
          </canvas> 
        </div>
     </div>          
  </ion-content>

这是我的app.js

angular.module('starter',['ionic','chart.js'])

.run(function($ionicPlatform) {
 $ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
  // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
  // for form inputs)
  cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

  // Don't remove this line unless you kNow what you are doing. It stops the viewport
  // from snapping when text inputs are focused. Ionic handles this internally for
  // a much nicer keyboard experience.
  cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
  StatusBar.styleDefault();
}
});
})

.controller("ExampleCtrl",function($scopE){
 $scope.labels = ["January","February","March","April","May","June","July"];
 $scope.series = ['Series A','Series B'];
 $scope.data = [
   [65,59,80,81,56,55,40],[28,48,40,19,86,27,90]
 ];

});

解决方法

您应该将图例设置为true.这将解决你的问题

$scope.labels = ["January","July"];
$scope.series = ['Series A','Series B'];
$scope.options = { legend: { display: true } }; // missing 

$scope.data = [
   [65,90]
];

希望这能解决你的问题.谢谢

大佬总结

以上是大佬教程为你收集整理的angularjs – 使用Charts.js在Angular Chart中不显示系列详细信息全部内容,希望文章能够帮你解决angularjs – 使用Charts.js在Angular Chart中不显示系列详细信息所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。