-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Charts support #311
Charts support #311
Changes from 5 commits
c3c19a2
9ec5ccc
cafb5c4
9ff7282
bc19e7c
6d8909a
da9fe50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<template> | ||
<ul> | ||
<li v-bind:key="chartConfig.title" v-for="chartConfig in chartConfigs"> | ||
<router-link | ||
:to="{ | ||
name: 'getCharts', | ||
params: { chartSlug: chartConfig.chart_slug } | ||
}" | ||
class="subtle" | ||
> | ||
<font-awesome-icon icon="level-up-alt" class="rotated90" /> | ||
<span>{{ chartConfig.title }}</span> | ||
</router-link> | ||
</li> | ||
</ul> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Vue from "vue" | ||
|
||
export default Vue.extend({ | ||
computed: { | ||
chartConfigs() { | ||
return this.$store.state.chartConfigs | ||
} | ||
}, | ||
async mounted() { | ||
await this.$store.dispatch("fetchChartConfigs") | ||
} | ||
}) | ||
</script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<div> | ||
<h3>{{ chartConfigs.title }}</h3> | ||
<pie-chart | ||
v-if="chartConfigs.chart_type == 'Pie'" | ||
:data="chartConfigs.data" | ||
></pie-chart> | ||
<line-chart | ||
v-else-if="chartConfigs.chart_type == 'Line'" | ||
:data="chartConfigs.data" | ||
></line-chart> | ||
<column-chart | ||
v-else-if="chartConfigs.chart_type == 'Column'" | ||
:data="chartConfigs.data" | ||
></column-chart> | ||
<bar-chart | ||
v-else-if="chartConfigs.chart_type == 'Bar'" | ||
:data="chartConfigs.data" | ||
></bar-chart> | ||
<area-chart | ||
v-else-if="chartConfigs.chart_type == 'Area'" | ||
:data="chartConfigs.data" | ||
></area-chart> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Vue from "vue" | ||
|
||
export default Vue.extend({ | ||
computed: { | ||
chartConfigs() { | ||
return this.$store.state.chartConfigs | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped lang="less"> | ||
h3 { | ||
text-transform: capitalize; | ||
text-align: center; | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<template> | ||
<div> | ||
<div class="sidebar_wrapper"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this for? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is for a menu sidebar of equal width between the |
||
<ul class="table_list"> | ||
<TableNavItem | ||
v-bind:key="tableName" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the interaction between
chart.js
,highcharts
andvue-chartkick
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
chart.js
redundant? It looks like we're just usinghighcharts
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried
chart.js
? It's slightly smaller than highcharts, and it supports tree shaking, so we might get a smaller bundle size:https://bundlephobia.com/package/[email protected]
https://bundlephobia.com/package/[email protected]
Also, the licensing on highcharts looks complicated, so I'd rather stay away from it. chart.js is MIT like Piccolo Admin.
https://github.com/chartjs/Chart.js/blob/master/LICENSE.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake. I tried both libraries, so it accidentally stayed in
package.json
. This PR useshighcharts
, but I will switch toChart.js
in the next commit.