Skip to content

Commit

Permalink
Allow changing chart options upon creation
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Ottaviano <[email protected]>
  • Loading branch information
lucaotta committed Jun 25, 2014
1 parent 110d921 commit 13471bf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions QChart.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Canvas {
property alias chartAnimationEasing: chartAnimator.easing.type;
property alias chartAnimationDuration: chartAnimator.duration;
property int chartAnimationProgress: 0;
property var chartOptions: ({})

// /////////////////////////////////////////////////////////////////
// Callbacks
Expand All @@ -39,22 +40,22 @@ Canvas {

switch(chartType) {
case Charts.ChartType.BAR:
chart = new Charts.Chart(canvas, canvas.getContext("2d")).Bar(chartData);
chart = new Charts.Chart(canvas, canvas.getContext("2d")).Bar(chartData, chartOptions);
break;
case Charts.ChartType.DOUGHNUT:
chart = new Charts.Chart(canvas, canvas.getContext("2d")).Doughnut(chartData);
chart = new Charts.Chart(canvas, canvas.getContext("2d")).Doughnut(chartData, chartOptions);
break;
case Charts.ChartType.LINE:
chart = new Charts.Chart(canvas, canvas.getContext("2d")).Line(chartData);
chart = new Charts.Chart(canvas, canvas.getContext("2d")).Line(chartData, chartOptions);
break;
case Charts.ChartType.PIE:
chart = new Charts.Chart(canvas, canvas.getContext("2d")).Pie(chartData);
chart = new Charts.Chart(canvas, canvas.getContext("2d")).Pie(chartData, chartOptions);
break;
case Charts.ChartType.POLAR:
chart = new Charts.Chart(canvas, canvas.getContext("2d")).PolarArea(chartData);
chart = new Charts.Chart(canvas, canvas.getContext("2d")).PolarArea(chartData, chartOptions);
break;
case Charts.ChartType.RADAR:
chart = new Charts.Chart(canvas, canvas.getContext("2d")).Radar(chartData);
chart = new Charts.Chart(canvas, canvas.getContext("2d")).Radar(chartData, chartOptions);
break;
default:
console.log('Chart type should be specified.');
Expand Down

0 comments on commit 13471bf

Please sign in to comment.