c1.documentReady(function () {
var theChart = wijmo.Control.getControl(
'#theChart'
);
theChart.itemsSource = getData();
var sales =
new
wijmo.chart.analytics.Waterfall();
sales.name =
'Sales'
;
sales.binding =
'sales'
;
sales.styles = {
start: { fill:
'blue'
, stroke:
'blue'
},
total: { fill:
'yellow'
, stroke:
'yellow'
},
falling: { fill:
'red'
, stroke:
'red'
},
rising: { fill:
'green'
, stroke:
'green'
},
connectorLines: { stroke:
'blue'
,
'stroke-dasharray'
:
'3, 1'
}
};
theChart.series.push(sales);
document.getElementById(
'connectorLines'
).addEventListener(
'click'
, function (e) {
sales.connectorLines = e.target.
checked
;
});
document.getElementById(
'showTotal'
).addEventListener(
'click'
, function (e) {
sales.showTotal = e.target.
checked
;
});
document.getElementById(
'btnRandomize'
).addEventListener(
'click'
, function () {
theChart.itemsSource = getData();
});
function getData() {
var data = []
date =
new
Date();
for
(var month = 0; month < 12; month++) {
data.push({
date: date,
sales: (Math.random() - .4) * 1000
});
date = wijmo.DateTime.addMonths(date, 1);
}
return
data;
}
});