Skip to content

Instantly share code, notes, and snippets.

@JeroenVinke
Created March 23, 2016 18:05
Show Gist options
  • Save JeroenVinke/9934fbebff392d967104 to your computer and use it in GitHub Desktop.
Save JeroenVinke/9934fbebff392d967104 to your computer and use it in GitHub Desktop.
<template>
<ak-chart k-title.bind="{text: 'TEST'}"
k-data-source.bind="datasource"
k-legend.bind="{position: 'bottom'}"
k-series.bind="series"
k-series-defaults.bind="seriesDefaults"
k-series-axis.bind="seriesValueAxis"
k-category-axis.bind="seriesCategoryAxis"
k-tooltip.bind="seriesTooltip">
</ak-chart>
</template>
import {inject} from 'aurelia-framework';
export class Test{
constructor(){
this.datasource = {};
this.series = [];
this.seriesDefaults = [];
this.seriesValueAxis = {};
this.seriesCategoryAxis = {};
this.seriesTooltip = {};
}
activate(){
this.seriesDatasourceSet();
this.seriesDefaultsSet();
this.seriesSet();
this.seriesValueAxisSet();
this.seriesCategoryAxisSet();
this.seriesTooltipSet();
}
seriesDatasourceSet(){
var demoData = [{
"country": "United States",
"year": "1994",
"value": 4.9
},
{
"country": "United States",
"year": "1995",
"value": 9.2
},
{
"country": "United States",
"year": "1996",
"value": 16.4
}];
return this.datasource= {
data: demoData
};
}
seriesDefaultsSet(){
return this.seriesDefaults= {
type: 'line',
labels: {
visible: true,
format: '{0}%',
background: 'transparent'
}
};
}
seriesSet(){
return this.series= [{
field: 'value',
name: 'United States'
}];
}
seriesValueAxisSet(){
return this.seriesValueAxis = {
labels: {
format: '{0}%'
},
line: {
visible: false
}
};
}
seriesCategoryAxisSet(){
return this.seriesCategoryAxis = {
field: 'year',
majorGridLines: {
visible: false
}
};
}
seriesTooltipSet(){
return this.seriesTooltip = {
visible: true,
format: '{0}%',
template: '${category} - ${value}%'
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment