From 7f02343898ed329f347283e4b9b0f51aa07ee575 Mon Sep 17 00:00:00 2001 From: Matt Gibbs Date: Fri, 25 Sep 2015 17:28:29 -0400 Subject: [PATCH] More Test data Had to add some explicit typing to some of the example functions just to get the test to complete successfully. Maybe that shouldn't be a concern in the test files? --- chartist/chartist-tests.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/chartist/chartist-tests.ts b/chartist/chartist-tests.ts index cc3b8a692..513ee255d 100644 --- a/chartist/chartist-tests.ts +++ b/chartist/chartist-tests.ts @@ -28,3 +28,41 @@ var chart = new Chartist.Line('.ct-chart', { }, low: 0 }); + +new Chartist.Line('.ct-chart', { + labels: ['1', '2', '3', '4', '5', '6'], + series: [ + { + name: 'Fibonacci sequence', + data: [1, 2, 3, 5, 8, 13] + }, + { + name: 'Golden section', + data: [1, 1.618, 2.618, 4.236, 6.854, 11.09] + } + ] +}); + + + +var data = { + series: [5, 3, 4] +}; + +var sum = function(a: number, b: number) { return a + b }; + +new Chartist.Pie('.ct-chart', data, { + labelInterpolationFnc: function(value: number) { + return Math.round(value / data.series.reduce(sum) * 100) + '%'; + } +}); + +new Chartist.Pie('.ct-chart', { + series: [20, 10, 30, 40] +}, { + donut: true, + donutWidth: 60, + startAngle: 270, + total: 200, + showLabel: false +});