Skip to content

Commit

Permalink
feature: save chart reference to DOM for future usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Crempa committed Mar 31, 2018
1 parent 0fe0ceb commit ecc6221
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/templates/c3/CategoryChart.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
data.groups.push(group);
<?php endforeach ?>

c3.generate({
var chart = c3.generate({
bindto: '#<?php echo $chartId ?>',
grid: {
x: {
Expand All @@ -93,5 +93,6 @@
axis: axis,
data: data
});
$('#<?php echo $chartId ?>').data('c3-chart', chart);
})();
</script>
3 changes: 2 additions & 1 deletion src/templates/c3/Chart.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
data.groups.push(group);
<?php endforeach ?>

c3.generate({
var chart = c3.generate({
bindto: '#<?php echo $chartId ?>',
grid: {
x: {
Expand All @@ -96,5 +96,6 @@
axis: axis,
data: data
});
$('#<?php echo $chartId ?>').data('c3-chart', chart);
})();
</script>
3 changes: 2 additions & 1 deletion src/templates/c3/DateChart.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
data.groups.push(group);
<?php endforeach ?>

c3.generate({
var chart = c3.generate({
bindto: '#<?php echo $chartId ?>',
grid: {
x: {
Expand All @@ -112,5 +112,6 @@
axis: axis,
data: data
});
$('#<?php echo $chartId ?>').data('c3-chart', chart);
})();
</script>
3 changes: 2 additions & 1 deletion src/templates/c3/DonutChart.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@
data.columns.push(column);
<?php endforeach ?>

c3.generate({
var chart = c3.generate({
bindto: '#<?php echo $chartId ?>',
data: data,
donut: donut
});
$('#<?php echo $chartId ?>').data('c3-chart', chart);
})();
</script>
<?php endif ?>
3 changes: 2 additions & 1 deletion src/templates/c3/PieChart.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@
data.columns.push(column);
<?php endforeach ?>

c3.generate({
var chart = c3.generate({
bindto: '#<?php echo $chartId ?>',
data: data,
pie: pie
});
$('#<?php echo $chartId ?>').data('c3-chart', chart);
})();
</script>
<?php endif ?>

0 comments on commit ecc6221

Please sign in to comment.