gpt4 book ai didi

angularjs - 使用 Charts.js 的 Angular 图表中未显示系列详细信息

转载 作者:行者123 更新时间:2023-12-03 18:17:25 25 4
gpt4 key购买 nike

我正在我的 ionic 应用程序中实现 Angular 折线图功能,如链接 https://jtblin.github.io/angular-chart.js/ 中所述

图表显示成功,但图表下方的系列详情没有显示(意思是哪种颜色代表哪条线)

我正在通过 Chart-series 字段,但仍未显示。
好心提醒。

这是
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", "February", "March", "April", "May", "June", "July"];
$scope.series = ['Series A', 'Series B'];
$scope.options = { legend: { display: true } }; // missing

$scope.data = [
[65, 59, 80, 81, 56, 55, 40],
[28, 48, 40, 19, 86, 27, 90]
];

希望这能解决您的问题。谢谢

关于angularjs - 使用 Charts.js 的 Angular 图表中未显示系列详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39842911/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com