Last active
July 19, 2016 18:49
-
-
Save adriatic/db89ee4bd8a681c63bfefd60da87b8ea to your computer and use it in GitHub Desktop.
Bubble charts: binding to grouped 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> | |
<ak-chart k-title.bind="{text: 'Olypmic Medals Won by Japan'}" | |
k-data-source.bind="datasource" | |
k-legend.bind="legend" | |
k-chart-area.bind="chartArea" | |
k-series.bind="series" | |
k-x-axis.bind="xAxis" | |
k-y-axis.bind="yAxis" | |
k-tooltip.bind="tooltip"> | |
</ak-chart> | |
</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 BindingToGroupedData { | |
datasource = new kendo.data.DataSource({ | |
transport: { | |
read: function(options) { | |
return System.import('./olympics-japan.json!json') | |
.then(data => options.success(data)); | |
} | |
}, | |
group: { | |
field: 'country' | |
} | |
}); | |
legend = { | |
visible: false | |
}; | |
chartArea = { | |
background: '' | |
}; | |
series = [{ | |
type: 'bubble', | |
minSize: 0, | |
maxSize: 70, | |
xField: 'year', | |
yField: 'standing', | |
sizeField: 'number', | |
colorField: 'medalColor', | |
opacity: 0.9 | |
}]; | |
xAxis = { | |
labels: { | |
skip: 1, | |
margin: {top: -25} | |
}, | |
majorUnit: 4, | |
min: 1980, | |
max: 2015, | |
majorGridLines: { | |
visible: false | |
}, | |
line: { | |
visible: false | |
} | |
}; | |
yAxis = { | |
labels: { | |
step: 1, | |
skip: 1, | |
template: '#= value # place', | |
margin: {right: -30}, | |
padding: {left: 20} | |
}, | |
majorUnit: 1, | |
min: 0, | |
max: 3.7, | |
majorGridLines: { | |
visible: false | |
}, | |
line: { | |
visible: false | |
} | |
}; | |
tooltip = { | |
visible: true, | |
template: '#= value.x #: #= value.size # Medals' | |
}; | |
} |
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": 1984, | |
"standing": 1, | |
"number": 10, | |
"country": "Japan", | |
"medalColor": "#f3ac32" | |
},{ | |
"year": 1988, | |
"standing": 1, | |
"number": 4, | |
"country": "Japan", | |
"medalColor": "#f3ac32" | |
},{ | |
"year": 1992, | |
"standing": 1, | |
"number": 3, | |
"country": "Japan", | |
"medalColor": "#f3ac32" | |
},{ | |
"year": 1996, | |
"standing": 1, | |
"number": 3, | |
"country": "Japan", | |
"medalColor": "#f3ac32" | |
},{ | |
"year": 2000, | |
"standing": 1, | |
"number": 5, | |
"country": "Japan", | |
"medalColor": "#f3ac32" | |
},{ | |
"year": 2004, | |
"standing": 1, | |
"number": 16, | |
"country": "Japan", | |
"medalColor": "#f3ac32" | |
},{ | |
"year": 2008, | |
"standing": 1, | |
"number": 9, | |
"country": "Japan", | |
"medalColor": "#f3ac32" | |
},{ | |
"year": 2012, | |
"standing": 1, | |
"number": 7, | |
"country": "Japan", | |
"medalColor": "#f3ac32" | |
},{ | |
"year": 1984, | |
"standing": 2, | |
"number": 8, | |
"country": "Japan", | |
"medalColor": "#b8b8b8" | |
},{ | |
"year": 1988, | |
"standing": 2, | |
"number": 3, | |
"country": "Japan", | |
"medalColor": "#b8b8b8" | |
},{ | |
"year": 1992, | |
"standing": 2, | |
"number": 8, | |
"country": "Japan", | |
"medalColor": "#b8b8b8" | |
},{ | |
"year": 1996, | |
"standing": 2, | |
"number": 6, | |
"country": "Japan", | |
"medalColor": "#b8b8b8" | |
},{ | |
"year": 2000, | |
"standing": 2, | |
"number": 8, | |
"country": "Japan", | |
"medalColor": "#b8b8b8" | |
},{ | |
"year": 2004, | |
"standing": 2, | |
"number": 9, | |
"country": "Japan", | |
"medalColor": "#b8b8b8" | |
},{ | |
"year": 2008, | |
"standing": 2, | |
"number": 6, | |
"country": "Japan", | |
"medalColor": "#b8b8b8" | |
},{ | |
"year": 2012, | |
"standing": 2, | |
"number": 14, | |
"country": "Japan", | |
"medalColor": "#b8b8b8" | |
},{ | |
"year": 1984, | |
"standing": 3, | |
"number": 14, | |
"country": "Japan", | |
"medalColor": "#bb6e36" | |
},{ | |
"year": 1988, | |
"standing": 3, | |
"number": 7, | |
"country": "Japan", | |
"medalColor": "#bb6e36" | |
},{ | |
"year": 1992, | |
"standing": 3, | |
"number": 11, | |
"country": "Japan", | |
"medalColor": "#bb6e36" | |
},{ | |
"year": 1996, | |
"standing": 3, | |
"number": 5, | |
"country": "Japan", | |
"medalColor": "#bb6e36" | |
},{ | |
"year": 2000, | |
"standing": 3, | |
"number": 5, | |
"country": "Japan", | |
"medalColor": "#bb6e36" | |
},{ | |
"year": 2004, | |
"standing": 3, | |
"number": 12, | |
"country": "Japan", | |
"medalColor": "#bb6e36" | |
},{ | |
"year": 2008, | |
"standing": 3, | |
"number": 10, | |
"country": "Japan", | |
"medalColor": "#bb6e36" | |
},{ | |
"year": 2012, | |
"standing": 3, | |
"number": 17, | |
"country": "Japan", | |
"medalColor": "#bb6e36" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment