Skip to content

Commit

Permalink
docs(demo): fix broken demos, lowercase id
Browse files Browse the repository at this point in the history
Fix issues in JavaScript resulting from automated lowercasing of the id in DataFromURL-csv, JSONData and Export.

Fix #840
Close #841
  • Loading branch information
batram authored and netil committed Apr 15, 2019
1 parent 179b7a3 commit 5ee8a08
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ Alexandre Araujo <https://github.com/oliveiraaraujo>
Jinwoo Oh <[email protected]>
Nirmal Guna <[email protected]>
Michael Yungerman <[email protected]>
Malte Batram <[email protected]>
3 changes: 2 additions & 1 deletion demo/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ var billboardDemo = {
},

getLowerFirstCase(str) {
return str.charAt(0).toLowerCase() + str.slice(1);
return /^(JSON)/.test(str) ?
str : str.charAt(0).toLowerCase() + str.slice(1);
},

_addChartInstance: function(type, key, index, code) {
Expand Down
28 changes: 14 additions & 14 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ var demos = {
chart.timer = [
setTimeout(function() {
bb.generate({
bindto: "#DataFromURL-csv",
bindto: "#dataFromURL-csv",
data: {
url: './data/test.json',
mimeType: "json"
Expand Down Expand Up @@ -1644,9 +1644,9 @@ var demos = {
],
type: "bar",
colors: {
data1: '#ff0000',
data2: '#00ff00',
data3: '#0000ff'
data1: "#ff0000",
data2: "#00ff00",
data3: "#0000ff"
},
color: function(color, d) {
// d will be "id" when called for legends
Expand Down Expand Up @@ -3412,9 +3412,9 @@ d3.select(".chart_area")
],
type: "bar",
colors: {
data1: '#ff0000',
data2: '#00ff00',
data3: '#0000ff'
data1: "#ff0000",
data2: "#00ff00",
data3: "#0000ff"
},
labels: true
}
Expand All @@ -3423,17 +3423,17 @@ d3.select(".chart_area")
chart.timer = [
setTimeout(function() {
chart.data.colors({
data1: d3.rgb('#ff0000').darker(1),
data2: d3.rgb('#00ff00').darker(1),
data3: d3.rgb('#0000ff').darker(1)
data1: d3.rgb("#ff0000").darker(1),
data2: d3.rgb("#00ff00").darker(1),
data3: d3.rgb("#0000ff").darker(1)
});
}, 1000),

setTimeout(function() {
chart.data.colors({
data1: d3.rgb('#ff0000').darker(2),
data2: d3.rgb('#00ff00').darker(2),
data3: d3.rgb('#0000ff').darker(2)
data1: d3.rgb("#ff0000").darker(2),
data2: d3.rgb("#00ff00").darker(2),
data3: d3.rgb("#0000ff").darker(2)
});
}, 2000)
];
Expand Down Expand Up @@ -3478,7 +3478,7 @@ d3.select(".chart_area")
// crate a div element
var exported = document.createElement("div");

document.getElementById("Export")
document.getElementById("export")
.insertAdjacentElement("afterend", exported);

// Call after the chart finished rendering
Expand Down

0 comments on commit 5ee8a08

Please sign in to comment.