Created
March 23, 2016 18:05
-
-
Save JeroenVinke/9934fbebff392d967104 to your computer and use it in GitHub Desktop.
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: '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> |
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
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