Chart Rendering fixed for analytics
This commit is contained in:
parent
6158707daa
commit
7c957e5135
1 changed files with 8 additions and 0 deletions
|
|
@ -260,11 +260,19 @@
|
||||||
data: tsb,
|
data: tsb,
|
||||||
borderColor: 'rgb(204, 255, 0)',
|
borderColor: 'rgb(204, 255, 0)',
|
||||||
backgroundColor: function(context) {
|
backgroundColor: function(context) {
|
||||||
|
// Check if parsed data exists (can be undefined during legend rendering)
|
||||||
|
if (!context.parsed) {
|
||||||
|
return 'rgba(204, 255, 0, 0.2)';
|
||||||
|
}
|
||||||
const value = context.parsed.y;
|
const value = context.parsed.y;
|
||||||
return value >= 0 ? 'rgba(16, 185, 129, 0.2)' : 'rgba(239, 68, 68, 0.2)';
|
return value >= 0 ? 'rgba(16, 185, 129, 0.2)' : 'rgba(239, 68, 68, 0.2)';
|
||||||
},
|
},
|
||||||
segment: {
|
segment: {
|
||||||
borderColor: function(context) {
|
borderColor: function(context) {
|
||||||
|
// Check if parsed data exists
|
||||||
|
if (!context.p1 || !context.p1.parsed) {
|
||||||
|
return 'rgb(204, 255, 0)';
|
||||||
|
}
|
||||||
const value = context.p1.parsed.y;
|
const value = context.p1.parsed.y;
|
||||||
return value >= 0 ? 'rgb(16, 185, 129)' : 'rgb(239, 68, 68)';
|
return value >= 0 ? 'rgb(16, 185, 129)' : 'rgb(239, 68, 68)';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue