Last active
July 19, 2016 18:49
-
-
Save adriatic/2c3e1c7ecd471b484c58e9047284fe5c to your computer and use it in GitHub Desktop.
Donut charts" Binding to remote data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div id="example"> | |
<div class="demo-section k-content wide"> | |
<ak-chart k-title.bind="title" | |
k-data-source.bind="datasource" | |
k-legend.bind="legend" | |
k-series-defaults.bind="seriesDefaults" | |
k-series.bind="series" | |
k-value-axis.bind="valueAxis" | |
k-category-axis.bind="categoryAxis" | |
k-tooltip.bind="tooltip"> | |
</ak-chart> | |
</div> | |
</div> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class BindingToRemoteData { | |
datasource = new kendo.data.DataSource({ | |
transport: { | |
read: function(options) { | |
return System.import('./screen-resolution.json!json') | |
.then(data => options.success(data)); | |
} | |
}, | |
sort: { | |
field: 'order', | |
dir: 'asc' | |
}, | |
group: { | |
field: 'year' | |
} | |
}); | |
legend = { | |
position: 'top' | |
}; | |
title = { | |
text: '1024x768 screen resolution trends' | |
}; | |
seriesDefaults = { | |
type: 'donut', | |
startAngle: 270 | |
}; | |
series = [{ | |
field: 'share', | |
categoryField: 'resolution', | |
visibleInLegendField: 'visibleInLegend', | |
padding: 10 | |
}]; | |
tooltip = { | |
visible: true, | |
template: '#= dataItem.resolution #: #= value #% (#= dataItem.year #)' | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Aurelia KendoUI bridge</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.common.min.css"> | |
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.rtl.min.css"> | |
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.default.min.css"> | |
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.mobile.all.min.css"> | |
<script src="https://kendo.cdn.telerik.com/2016.1.226/js/jszip.min.js"></script> | |
</head> | |
<body aurelia-app="main"> | |
<h1>Loading...</h1> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.6/system.js"></script> | |
<script src="https://rawgit.com/aurelia-ui-toolkits/aurelia-kendoui-bundles/0.3.5/config2.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function configure(aurelia) { | |
aurelia.use | |
.standardConfiguration() | |
.developmentLogging() | |
.plugin('aurelia-kendoui-bridge', kendo => kendo.pro()); | |
aurelia.start().then(a => a.setRoot()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"year": 2000, | |
"resolution": "1024x768", | |
"share": 25, | |
"visibleInLegend": false, | |
"order": 1 | |
},{ | |
"year": 2000, | |
"resolution": "Other", | |
"share": 75, | |
"visibleInLegend": false, | |
"order": 2, | |
"color": "#ccc" | |
},{ | |
"year": 2001, | |
"resolution": "1024x768", | |
"share": 29, | |
"visibleInLegend": false, | |
"order": 1 | |
},{ | |
"year": 2001, | |
"resolution": "Other", | |
"share": 71, | |
"visibleInLegend": false, | |
"order": 2, | |
"color": "#ccc" | |
},{ | |
"year": 2002, | |
"resolution": "1024x768", | |
"share": 34, | |
"visibleInLegend": false, | |
"order": 1 | |
},{ | |
"year": 2002, | |
"resolution": "Other", | |
"share": 66, | |
"visibleInLegend": false, | |
"order": 2, | |
"color": "#ccc" | |
},{ | |
"year": 2003, | |
"resolution": "1024x768", | |
"share": 40, | |
"visibleInLegend": false, | |
"order": 1 | |
},{ | |
"year": 2003, | |
"resolution": "Other", | |
"share": 60, | |
"visibleInLegend": false, | |
"order": 2, | |
"color": "#ccc" | |
},{ | |
"year": 2004, | |
"resolution": "1024x768", | |
"share": 47, | |
"visibleInLegend": false, | |
"order": 1 | |
},{ | |
"year": 2004, | |
"resolution": "Other", | |
"share": 53, | |
"visibleInLegend": false, | |
"order": 2, | |
"color": "#ccc" | |
},{ | |
"year": 2005, | |
"resolution": "1024x768", | |
"share": 53, | |
"visibleInLegend": false, | |
"order": 1 | |
},{ | |
"year": 2005, | |
"resolution": "Other", | |
"share": 47, | |
"visibleInLegend": false, | |
"order": 2, | |
"color": "#ccc" | |
},{ | |
"year": 2006, | |
"resolution": "1024x768", | |
"share": 57, | |
"visibleInLegend": false, | |
"order": 1, | |
"color": "#c00" | |
},{ | |
"year": 2006, | |
"resolution": "Other", | |
"share": 43, | |
"visibleInLegend": false, | |
"order": 2, | |
"color": "#ccc" | |
},{ | |
"year": 2007, | |
"resolution": "1024x768", | |
"share": 54, | |
"visibleInLegend": false, | |
"order": 1 | |
},{ | |
"year": 2007, | |
"resolution": "Other", | |
"share": 46, | |
"visibleInLegend": false, | |
"order": 2, | |
"color": "#ccc" | |
},{ | |
"year": 2008, | |
"resolution": "1024x768", | |
"share": 48, | |
"visibleInLegend": false, | |
"order": 1 | |
},{ | |
"year": 2008, | |
"resolution": "Other", | |
"share": 52, | |
"visibleInLegend": false, | |
"order": 2, | |
"color": "#ccc" | |
},{ | |
"year": 2009, | |
"resolution": "1024x768", | |
"share": 36, | |
"visibleInLegend": false, | |
"order": 1 | |
},{ | |
"year": 2009, | |
"resolution": "Other", | |
"share": 64, | |
"visibleInLegend": false, | |
"order": 2, | |
"color": "#ccc" | |
}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment