KB - Wijmo 5 - Bare FlexChart
by Joel Parks
HTML
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://cdn.wijmo.com/5.latest/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.input.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.chart.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/interop/angular/wijmo.angular.min.js"></script>
<script src="http://cdn.wijmo.com/5.20143.22/controls/wijmo.gauge.min.js"></script>
<!-- mark this as an Angular application and give it a controller -->
<div ng-app="app" ng-controller="appCtrl" class="container">
<h1>Wijmo 5 - FlexChart Minimal (Angular)</h1>
<p>This is a <b>FlexChart</b> control showing data:</p>
<wj-flex-chart items-source="data" plot-margin=0 style="border:none">
<!--Y-Axis properties: bars every 2000 units, title 'Units', and places the Y-Axis on the right-hand side-->
<wj-flex-chart-axis wj-property="axisY" major-unit=null title="Units"></wj-flex-chart-axis>
<!--X-Axis properties: reversed so that the origin is in the bottom right-->
<wj-flex-chart-axis wj-property="axisX"></wj-flex-chart-axis>
<!--Series properties: binds the series to the 'sales' value, titles the series as 'Sales'-->
<wj-flex-chart-series binding="sales"></wj-flex-chart-series>
<!--Legend properties: positions the legend at the bottom of the graph-->
<wj-flex-chart-legend position="Bottom"></wj-flex-chart-legend>
</wj-flex-chart>
</div>
CSS
/* .wj-flexgrid {
height: 150px;
margin-top:10px;
}
.wj-flexchart {
height: 300px;
}*/
JavaScript
// define app, include Wijmo 5 directives
var app = angular.module('app', ['wj']);
// controller
app.controller('appCtrl', function($scope) {
// create some random data
var months = 'January,February,March,April,May,June'.split(',');
var data = [], data1 = [], data2 = [];
for (var i = 0; i < months.length; i++) {
data1.push({
months: months[i],
sales: Math.random() * 10000
});
data2.push({
months: months[i],
sales: Math.random() * 10000
});
}
data = data1;
// expose data as a CollectionView to get events
$scope.data = new wijmo.collections.CollectionView(data);
});