Why an error after changing the sort order of underlying data? #141
-
|
Hi If the user chooses to see the top X items, the chart works perfectly, but if they choose the bottom X items, I get an error The line generating this error is in the BAC_Chart module, within CreateChart, on the execution of the line I've attached samples of the two HTML files created - the one which works and the one which doesn't. I've also attached a file containing the data which should be the source of the chart - I wondered if there were "weird" characters in someone's name or something like that, but I can't see anything I know virtually nothing about js, and little about HTML, but I can't see any reason why the error would occur based simply on the data being sorted differently, so am I likely to be missing something else? Thanks for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
Hi @andrewmrichards ! |
Beta Was this translation helpful? Give feedback.
-
|
Hi Thomas
I uploaded them to the Github comments / report.
But here they are attached to this email too.
Many thanks
Andrew
From: Thomas Möller ***@***.***>
Sent: Friday, July 21, 2023 11:32 AM
To: team-moeller/better-access-charts ***@***.***>
Cc: Andrew Richards ***@***.***>; Mention ***@***.***>
Subject: Re: [team-moeller/better-access-charts] Why an error after changing the sort order of underlying data? (Discussion #141)
Hi @andrewmrichards<https://github.com/andrewmrichards> !
Where can I find the attached files? I do not see them.
—
Reply to this email directly, view it on GitHub<#141 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ANRSZKE6LNT6NHNNI27CNYLXRJLDHANCNFSM6AAAAAA2RFHOQY>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<title>Chart</title>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=Edge'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-colorschemes"></script>
<style>
body { margin: 0; padding: 0; }
#container { width: 100%; }
</style>
</head>
<body>
<div id='container'>
<canvas id='myChart'></canvas>
</div>
<script>
Chart.defaults.global.animation.duration = 0;
Chart.defaults.global.animation.easing = 'linear';
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Andrea Brazzoduro','Emily Winkler','Gabriela Frei','Cora Gilroy-Ware','Georgina Montgomery','Judith Brown','Michael Feener','Lucy Clarke','Luke Blaxill','ATSUKO NAONO','Gregg Huff','Miles Pattenden','Philip Beeley','Hanneke Grootenboer','Jack Hepworth','Meryem Kalayci','Leonardo Davoudi','Wilfried Kisling','Benjamin Wardhaugh','Susan Brigden','INE JACOBS','Roy Foster','Kevin O'Rourke','HELENA HAMEROW','Jong Phil Park','Costanza Beltrami','Faramerz Dabhoiwala','Brenda Stevenson','Simon John','EDUARDO POSADA-CARBO',],
datasets: [
{label: 'WorkloadPoints' ,
data: [ 3, 3, 3, 6, 12, 15, 16, 17, 24, 25.5, 27, 27, 33, 35.5, 42, 42, 42, 45, 50.5, 64.5, 65.5, 68, 69, 75, 75.5, 78, 78, 86, 86.5, 88],
backgroundColor: Chart['colorschemes'].brewer.Paired12,
borderWidth: 1}
]
},
options: {
title: {
display: false,
},
legend: {
display: false
},
scales: {
yAxes: [{
id: 'first-y-Axis',
display: true
}],
xAxes: [{
id: 'first-x-Axis',
display: true
}]
},
plugins: {
colorschemes: {
scheme: 'brewer.Paired12'
}
}
}
});
</script>
</body>
</html>
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<title>Chart</title>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=Edge'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-colorschemes"></script>
<style>
body { margin: 0; padding: 0; }
#container { width: 100%; }
</style>
</head>
<body>
<div id='container'>
<canvas id='myChart'></canvas>
</div>
<script>
Chart.defaults.global.animation.duration = 0;
Chart.defaults.global.animation.easing = 'linear';
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['IAN ARCHER','MARC MULHOLLAND','JOHN-PAUL GHOBRIAL','PEREGRINE GAUCI','SIAN POOLEY','STEPHEN TUCK','MATTHEW GRIMLEY','SELINA TODD','STEPHEN TUFFNELL','BRIAN YOUNG','CATHERINE HOLMES','SARAH MORTIMER','BENJAMIN JACKSON','CHRISTINA DE BELLAIGUE','STEVEN GUNN','STEPHEN BAXTER','John Davis','PAUL BETTS','IAN FORREST','JONATHAN PARKIN','Leif Dixon','HANNAH SMITH','DAVID PARROTT','ROBERT HARRIS','NICHOLAS STARGARDT','ADRIAN GREGORY','ANNA-MARIA MISRA','PHILIP BOOTH','KATHERINE LEBOW','ALEXANDRA GAJDA',],
datasets: [
{label: 'WorkloadPoints' ,
data: [ 1611.5, 1452.5, 1293, 1237, 1212.5, 1094, 1082.5, 1070.5, 1051, 1043.5, 1038.5, 1029.5, 1012, 993, 931.5, 893.5, 887, 881.5, 875.5, 855.5, 854.5, 851, 849, 829.5, 802, 800, 799.5, 782, 738.5, 736.5],
backgroundColor: Chart['colorschemes'].brewer.Paired12,
borderWidth: 1}
]
},
options: {
title: {
display: false,
},
legend: {
display: false
},
scales: {
yAxes: [{
id: 'first-y-Axis',
display: true
}],
xAxes: [{
id: 'first-x-Axis',
display: true
}]
},
plugins: {
colorschemes: {
scheme: 'brewer.Paired12'
}
}
}
});
</script>
</body>
</html>
"Andrea Brazzoduro","Examining","3"
"ATSUKO NAONO","Examining","25.5"
"Benjamin Wardhaugh","Examining","50.5"
"Brenda Stevenson","Examining","86"
"Cora Gilroy-Ware","Examining","6"
"Costanza Beltrami","Examining","78"
"EDUARDO POSADA-CARBO","Examining","88"
"Emily Winkler","Examining","3"
"Faramerz Dabhoiwala","Examining","78"
"Gabriela Frei","Examining","3"
"Georgina Montgomery","Examining","12"
"Gregg Huff","Examining","27"
"Hanneke Grootenboer","Examining","35.5"
"HELENA HAMEROW","Examining","75"
"INE JACOBS","Examining","65.5"
"Jack Hepworth","Examining","42"
"Jong Phil Park","Examining","75.5"
"Judith Brown","Examining","15"
"Kevin O'Rourke","Examining","69"
"Leonardo Davoudi","Examining","42"
"Lucy Clarke","Examining","17"
"Luke Blaxill","Examining","24"
"Meryem Kalayci","Examining","42"
"Michael Feener","Examining","16"
"Miles Pattenden","Examining","27"
"Philip Beeley","Examining","33"
"Roy Foster","Examining","68"
"Simon John","Examining","86.5"
"Susan Brigden","Examining","64.5"
"Wilfried Kisling","Examining","45"
|
Beta Was this translation helpful? Give feedback.
-
|
Hi again
I’ve now taken a closer look at this in order to try to replicate the issue.
The problem is in one row of data, as highlighted here:
Postholder
Category
WorkloadPoints
Andrea Brazzoduro
Examining
3
INE JACOBS
Examining
65.5
Judith Brown
Examining
15
Kevin O'Rourke
Examining
69
Leonardo Davoudi
Examining
42
Lucy Clarke
Examining
17
The problem is with the data for Kevin O’Rourke – the aspostrophe causes the script to break. Take out the apostrophe and it works fine.
I’ve tried replacing the apostrophe with a double-apostrophe but this didn’t help…
I can adjust the code which populates this temp table with a tweak to remove any apostrophes, which is fine for now, but if there’s any way of adjusting the script to allow for apostrophes in names, that would be great!
Thanks for your help.
Andrew
From: Andrew Richards
Sent: Friday, July 21, 2023 11:52 AM
To: team-moeller/better-access-charts ***@***.***>
Subject: RE: [team-moeller/better-access-charts] Why an error after changing the sort order of underlying data? (Discussion #141)
Hi Thomas
I uploaded them to the Github comments / report.
But here they are attached to this email too.
Many thanks
Andrew
From: Thomas Möller ***@***.******@***.***>>
Sent: Friday, July 21, 2023 11:32 AM
To: team-moeller/better-access-charts ***@***.******@***.***>>
Cc: Andrew Richards ***@***.******@***.***>>; Mention ***@***.******@***.***>>
Subject: Re: [team-moeller/better-access-charts] Why an error after changing the sort order of underlying data? (Discussion #141)
Hi @andrewmrichards<https://github.com/andrewmrichards> !
Where can I find the attached files? I do not see them.
—
Reply to this email directly, view it on GitHub<#141 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ANRSZKE6LNT6NHNNI27CNYLXRJLDHANCNFSM6AAAAAA2RFHOQY>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<title>Chart</title>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=Edge'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-colorschemes"></script>
<style>
body { margin: 0; padding: 0; }
#container { width: 100%; }
</style>
</head>
<body>
<div id='container'>
<canvas id='myChart'></canvas>
</div>
<script>
Chart.defaults.global.animation.duration = 0;
Chart.defaults.global.animation.easing = 'linear';
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['Andrea Brazzoduro','Emily Winkler','Gabriela Frei','Cora Gilroy-Ware','Georgina Montgomery','Judith Brown','Michael Feener','Lucy Clarke','Luke Blaxill','ATSUKO NAONO','Gregg Huff','Miles Pattenden','Philip Beeley','Hanneke Grootenboer','Jack Hepworth','Meryem Kalayci','Leonardo Davoudi','Wilfried Kisling','Benjamin Wardhaugh','Susan Brigden','INE JACOBS','Roy Foster','Kevin O'Rourke','HELENA HAMEROW','Jong Phil Park','Costanza Beltrami','Faramerz Dabhoiwala','Brenda Stevenson','Simon John','EDUARDO POSADA-CARBO',],
datasets: [
{label: 'WorkloadPoints' ,
data: [ 3, 3, 3, 6, 12, 15, 16, 17, 24, 25.5, 27, 27, 33, 35.5, 42, 42, 42, 45, 50.5, 64.5, 65.5, 68, 69, 75, 75.5, 78, 78, 86, 86.5, 88],
backgroundColor: Chart['colorschemes'].brewer.Paired12,
borderWidth: 1}
]
},
options: {
title: {
display: false,
},
legend: {
display: false
},
scales: {
yAxes: [{
id: 'first-y-Axis',
display: true
}],
xAxes: [{
id: 'first-x-Axis',
display: true
}]
},
plugins: {
colorschemes: {
scheme: 'brewer.Paired12'
}
}
}
});
</script>
</body>
</html>
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<title>Chart</title>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=Edge'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-colorschemes"></script>
<style>
body { margin: 0; padding: 0; }
#container { width: 100%; }
</style>
</head>
<body>
<div id='container'>
<canvas id='myChart'></canvas>
</div>
<script>
Chart.defaults.global.animation.duration = 0;
Chart.defaults.global.animation.easing = 'linear';
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['IAN ARCHER','MARC MULHOLLAND','JOHN-PAUL GHOBRIAL','PEREGRINE GAUCI','SIAN POOLEY','STEPHEN TUCK','MATTHEW GRIMLEY','SELINA TODD','STEPHEN TUFFNELL','BRIAN YOUNG','CATHERINE HOLMES','SARAH MORTIMER','BENJAMIN JACKSON','CHRISTINA DE BELLAIGUE','STEVEN GUNN','STEPHEN BAXTER','John Davis','PAUL BETTS','IAN FORREST','JONATHAN PARKIN','Leif Dixon','HANNAH SMITH','DAVID PARROTT','ROBERT HARRIS','NICHOLAS STARGARDT','ADRIAN GREGORY','ANNA-MARIA MISRA','PHILIP BOOTH','KATHERINE LEBOW','ALEXANDRA GAJDA',],
datasets: [
{label: 'WorkloadPoints' ,
data: [ 1611.5, 1452.5, 1293, 1237, 1212.5, 1094, 1082.5, 1070.5, 1051, 1043.5, 1038.5, 1029.5, 1012, 993, 931.5, 893.5, 887, 881.5, 875.5, 855.5, 854.5, 851, 849, 829.5, 802, 800, 799.5, 782, 738.5, 736.5],
backgroundColor: Chart['colorschemes'].brewer.Paired12,
borderWidth: 1}
]
},
options: {
title: {
display: false,
},
legend: {
display: false
},
scales: {
yAxes: [{
id: 'first-y-Axis',
display: true
}],
xAxes: [{
id: 'first-x-Axis',
display: true
}]
},
plugins: {
colorschemes: {
scheme: 'brewer.Paired12'
}
}
}
});
</script>
</body>
</html>
"Andrea Brazzoduro","Examining","3"
"ATSUKO NAONO","Examining","25.5"
"Benjamin Wardhaugh","Examining","50.5"
"Brenda Stevenson","Examining","86"
"Cora Gilroy-Ware","Examining","6"
"Costanza Beltrami","Examining","78"
"EDUARDO POSADA-CARBO","Examining","88"
"Emily Winkler","Examining","3"
"Faramerz Dabhoiwala","Examining","78"
"Gabriela Frei","Examining","3"
"Georgina Montgomery","Examining","12"
"Gregg Huff","Examining","27"
"Hanneke Grootenboer","Examining","35.5"
"HELENA HAMEROW","Examining","75"
"INE JACOBS","Examining","65.5"
"Jack Hepworth","Examining","42"
"Jong Phil Park","Examining","75.5"
"Judith Brown","Examining","15"
"Kevin O'Rourke","Examining","69"
"Leonardo Davoudi","Examining","42"
"Lucy Clarke","Examining","17"
"Luke Blaxill","Examining","24"
"Meryem Kalayci","Examining","42"
"Michael Feener","Examining","16"
"Miles Pattenden","Examining","27"
"Philip Beeley","Examining","33"
"Roy Foster","Examining","68"
"Simon John","Examining","86.5"
"Susan Brigden","Examining","64.5"
"Wilfried Kisling","Examining","45"
|
Beta Was this translation helpful? Give feedback.
-
|
Hi @andrewmrichards , |
Beta Was this translation helpful? Give feedback.
Hi @andrewmrichards ,
it has taken a long time but today I found a solution for your problem.
Please try version 4.02.01
Please consider to close this discussion, when the new version works for you.
Regards!
Thomas