Skip to content

Commit

Permalink
➕ merge pull request #314 from devmount/data-in-progress-indication
Browse files Browse the repository at this point in the history
Data in progress indication
  • Loading branch information
devmount authored May 25, 2021
2 parents dd13cc7 + 9d95f55 commit 2c92f86
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
7 changes: 7 additions & 0 deletions src/Stats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,15 @@
:labels="yearsChartData.labels"
:ordinate="preferences.ordinate"
:abscissa="true"
:unfinished="active.period.end == null"
/>
<LineChart
v-if="tabs.total.years && preferences.sections.total.comparison"
:datasets="yearsComparedChartData.datasets"
:labels="yearsComparedChartData.labels"
:ordinate="preferences.ordinate"
:abscissa="true"
:unfinished="active.period.end == null"
/>
<!-- emails per quarter over total time -->
<LineChart
Expand All @@ -348,13 +350,15 @@
:labels="quartersChartData.labels"
:ordinate="preferences.ordinate"
:abscissa="true"
:unfinished="active.period.end == null"
/>
<LineChart
v-if="tabs.total.quarters && preferences.sections.total.comparison"
:datasets="quartersComparedChartData.datasets"
:labels="quartersComparedChartData.labels"
:ordinate="preferences.ordinate"
:abscissa="true"
:unfinished="active.period.end == null"
/>
<!-- emails per month over total time -->
<LineChart
Expand All @@ -363,13 +367,15 @@
:labels="monthsChartData.labels"
:ordinate="preferences.ordinate"
:abscissa="true"
:unfinished="active.period.end == null"
/>
<LineChart
v-if="tabs.total.months && preferences.sections.total.comparison"
:datasets="monthsComparedChartData.datasets"
:labels="monthsComparedChartData.labels"
:ordinate="preferences.ordinate"
:abscissa="true"
:unfinished="active.period.end == null"
/>
<!-- emails per week over total time -->
<LineChart
Expand All @@ -378,6 +384,7 @@
:labels="weeksChartData.labels"
:ordinate="preferences.ordinate"
:abscissa="true"
:unfinished="active.period.end == null"
/>
<LineChart
v-if="tabs.total.weeks && preferences.sections.total.comparison"
Expand Down
3 changes: 1 addition & 2 deletions src/charts/BarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ export default {
let datasets = this.datasets
datasets.map(d => {
d.backgroundColor = context => {
const chart = context.chart;
const { ctx, chartArea } = chart;
const { ctx, chartArea } = context.chart;
if (!chartArea) return null;
return transparentGradientBar(ctx, chartArea, d.borderColor, this.horizontal);
}
Expand Down
17 changes: 11 additions & 6 deletions src/charts/LineChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export default {
type: Number,
default: 2
},
unfinished: {
type: Boolean,
default: true
},
width: String,
height: String,
},
Expand All @@ -51,16 +55,16 @@ export default {
processedDatasets () {
let datasets = this.datasets
datasets.map(d => {
// gradient for background
d.backgroundColor = context => {
const chart = context.chart;
const { ctx, chartArea } = chart;
const { ctx, chartArea } = context.chart;
if (!chartArea) return null;
return transparentGradientLine(ctx, chartArea, d.borderColor);
};
// TODO: activate if https://github.com/chartjs/Chart.js/issues/9022 is fixed
// d.segment = {
// borderDash: ctx => ctx.p0.parsed.x == d.data.length-2 ? [10, 5] : undefined
// };
// dashed line for last segment
d.segment = {
borderDash: ctx => this.unfinished && ctx.p0.parsed.x == d.data.length-2 ? [10, 5] : undefined
};
})
return datasets
}
Expand Down Expand Up @@ -92,6 +96,7 @@ export default {
scales: {
x: {
display: this.abscissa,
alignToPixels: true,
stacked: false,
grid: {
display: false,
Expand Down

0 comments on commit 2c92f86

Please sign in to comment.