Skip to content

Commit

Permalink
Fix #16 property _model undefined in last graph column
Browse files Browse the repository at this point in the history
  • Loading branch information
danimart1991 committed May 18, 2020
1 parent 47deee5 commit 3863c67
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dist/pvpc-hourly-pricing-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,9 @@ class PVPCHourlyPricingCard extends LitElement {

ctx.save();
const selectedIndex =
chartInstance.tooltip._active && chartInstance.tooltip._active.length > 0
chartInstance.tooltip._active &&
chartInstance.tooltip._active.length > 0 &&
chartInstance.tooltip._active[0]._index < 24
? chartInstance.tooltip._active[0]._index
: today.getHours();
const yaxis = meta.controller.chart.scales['y-axis-0'];
Expand Down Expand Up @@ -459,7 +461,7 @@ class PVPCHourlyPricingCard extends LitElement {
intersect: false,
callbacks: {
title: function (items, data) {
const index = items[0].index != 24 ? items[0].index : 23;
const index = items[0].index != 24 ? items[0].index : (items[0].index = 23);

const date = new Date(data.labels[index]);
const initDate = that.getTimeString(date);
Expand All @@ -468,7 +470,7 @@ class PVPCHourlyPricingCard extends LitElement {
},
label: function (tooltipItems, data) {
let icon;
const index = tooltipItems.index != 24 ? tooltipItems.index : 23;
const index = tooltipItems.index != 24 ? tooltipItems.index : (tooltipItems[0].index = 23);

if (tooltipItems.datasetIndex === 0) {
if (index == minIndex) {
Expand Down

0 comments on commit 3863c67

Please sign in to comment.