Skip to content

Commit

Permalink
added LineChart component
Browse files Browse the repository at this point in the history
  • Loading branch information
christophevg committed Feb 28, 2024
1 parent af0e8c7 commit 70af737
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions baseweb/static/js/components/LineChart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Vue.component('LineChart', {
extends: VueChartJs.Line,
mixins: [ VueChartJs.mixins.reactiveProp ],
props: [ "options" ],
mounted: function() {
this.renderChart(this.chartData, this.merged_options);
},
computed: {
merged_options: function() {
return $.extend(true, this.default_options, this.options);
}
},
data : function() {
return {
default_options: {
responsive: true,
maintainAspectRatio: false,
legend: {
display: false
},
animation: {
duration: 500
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
}
}
});
1 change: 1 addition & 0 deletions baseweb/templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
<script src="/static/js/components/PageWithBanner.js"></script>
<script src="/static/js/components/PageWithStatus.js"></script>
<script src="/static/js/components/CollectionView.js"></script>
<script src="/static/js/components/LineChart.js"></script>

{% for file in components %}
<script src="/app/{{ file }}"></script>
Expand Down

0 comments on commit 70af737

Please sign in to comment.