我曾尝试使用 highcharts-ng 在 MEANJS 中创建图表,但它不起作用。什么是 highcharts-ng 的最佳选择。
1.我已经安装了highcharts使用
bower install highcharts-ng
2. 将其包含在 applicationModuleVendorDependencies 中
var applicationModuleVendorDependencies = ['ngResource', 'ui.router', 'ui.bootstrap', 'ui.utils','highcharts-ng'];
3.包含在资产库中
assets: {
lib: {
css: [
'public/lib/bootstrap/dist/css/bootstrap.css',
'public/lib/bootstrap/dist/css/bootstrap-theme.css',
],
js: [
'public/lib/angular/angular.js',
'public/lib/angular-resource/angular-resource.js',
'public/lib/angular-ui-router/release/angular-ui-router.js',
'public/lib/angular-ui-utils/ui-utils.js',
'public/lib/angular-bootstrap/ui-bootstrap-tpls.js',
'public/lib/highstock/js/highcharts.src.js',
'public/lib/highcharts-ng/dist/highcharts-ng.js',
'public/lib/file-saver/FileSaver.js'
]
4.将以下代码放入Index.htm
<div ng-app="myapp">
<div ng-controller="myctrl">
<div class='container'>
<highchart id='example1' config='config'></highchart>
</div>
</div>
</div>
并将以下代码放入控制器中
var myapp = angular.module('myapp', ["highcharts-ng"]);
myapp.controller('myctrl', function ($scope) {
$scope.config = { options: { chart: { type: 'column' }, }, xAxis: { categories: ['Yes', 'No'] }, series: [{ name: 'Votes', data: [0, 0] }], title: { text: 'Data-binding Example' }, subtitle: { text: 'Is this easy?' }, credits: { enabled: false }, loading: false };
视图没有显示图表。我错过了什么吗?谢谢你。