PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 3.6.61
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v3.6.61
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / resources / assets / admin / AllEntries / Components / chartView.vue

chartView.vue in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 3.6.61, at resources/assets/admin/AllEntries/Components/chartView.vue

78 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <template>
2 <div v-loading="loading" class="entriest_chart_wrapper">
3 <subscriber-chart :chart-data="chartData" :maxCumulativeValue="maxCumulativeValue"></subscriber-chart>
4 </div>
5 </template>
6
7 <script type="text/babel">
8 import SubscriberChart from './_chart'
9 import each from 'lodash/each';
10 export default {
11 name: 'EntriesChart',
12 components: {
13 SubscriberChart
14 },
15 props: ['form_id'],
16 data() {
17 return {
18 loading: true,
19 chartData: {},
20 maxCumulativeValue: 0,
21 stats: {
22 'January' : 20,
23 'February': 30
24 }
25 }
26 },
27 methods: {
28 fetchData() {
29 this.loading = true;
30
31 jQuery.get(window.ajaxurl, {
32 action: 'fluentform_get_all_entries_report',
33 form_id: this.form_id
34 })
35 .then(response => {
36 this.stats = response.data.stats;
37 this.setupChartItems();
38 })
39 .fail(error => {
40 console.log(error);
41 })
42 .always(() => {
43 this.loading = false;
44 });
45 },
46 setupChartItems() {
47 const labels = [];
48 const ItemValues = {
49 label: 'Submission Count',
50 yAxisID: 'byDate',
51 backgroundColor: 'rgba(81, 52, 178, 0.5)',
52 borderColor: '#b175eb',
53 data: [],
54 fill: false,
55 gridLines: {
56 display: false
57 }
58 };
59
60 let currentTotal = 0;
61 each(this.stats, (count, label) => {
62 ItemValues.data.push(count);
63 labels.push(label);
64 currentTotal += parseInt(count);
65 });
66 this.maxCumulativeValue = currentTotal + 10;
67 this.chartData = {
68 labels: labels,
69 datasets: [ItemValues]
70 }
71 }
72 },
73 mounted() {
74 this.fetchData();
75 }
76 }
77 </script>
78