Skip to content

Commit

Permalink
Merge pull request #200 from nzzdev/release-3.4.1
Browse files Browse the repository at this point in the history
Release 3.4.1
  • Loading branch information
fgervasi authored Feb 10, 2021
2 parents 8432fce + 6ed7ac2 commit 09a0560
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
},
"runtimeVersion": "12.10.0",
"program": "${workspaceRoot}/test/e2e-tests.js"
},
{
"type": "node",
"request": "launch",
"name": "Launch dom Tests",
"env": {
"DEBUG": true,
"DIVERGING_COLOR_SCHEMES": "[{ \"label\": \"one\", \"key\": 0, \"scheme_name\": \"diverging_one\" }, { \"label\": \"two\", \"key\": 1, \"scheme_name\": \"diverging_two\" }, { \"label\": \"three\", \"key\": 2, \"scheme_name\": \"diverging_three\" } ]",
"FONTS": "[{\"url\": \"https://assets.static-nzz.ch/nzz-niobe/assets/fonts/GT-America-Standard-Regular.otf\",\"name\": \"nzz-sans-serif\",\"filename\": \"nzz-sans-serif.otf\"}]"
},
"runtimeVersion": "12.10.0",
"program": "${workspaceRoot}/test/dom-tests.js"
}
]
}
3 changes: 1 addition & 2 deletions chartTypes/area/vega-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@
"ticks": false,
"labels": true,
"tickCount": 4,
"labelPadding": 2,
"format": "~r"
"labelPadding": 2
}
],
"marks": [
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "q-chart",
"version": "3.4.0",
"version": "3.4.1",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
80 changes: 80 additions & 0 deletions resources/fixtures/data/area-y-legend-thousand-separator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"title": "FIXTURE: Area - y legend thousand separator",
"data": [
[
"Jahr",
"A"
],
[
"2012",
"1"
],
[
"2013",
"20"
],
[
"2014",
"300"
],
[
"2015",
"2000"
],
[
"2016",
"7501"
],
[
"2017",
"10000"
],
[
"2018",
"49999"
],
[
"2019",
"50001"
],
[
"2020",
"75111"
],
[
"2021",
"99999"
]
],
"allowDownloadData": false,
"sources": [],
"options": {
"chartType": "Area",
"hideAxisLabel": true,
"highlightDataSeries": [],
"highlightDataRows": [],
"annotations": {},
"barOptions": {
"isBarChart": false,
"forceBarsOnSmall": false
},
"dateSeriesOptions": {
"interval": "auto",
"prognosisStart": 1
},
"lineChartOptions": {
"reverseYScale": false,
"lineInterpolation": "linear",
"isStockChart": false
},
"dotplotOptions": {},
"arrowOptions": {
"colorScheme": 0
},
"colorOverwritesSeries": [],
"colorOverwritesRows": [],
"areaChartOptions": {
"areaInterpolation": "linear"
}
}
}
1 change: 1 addition & 0 deletions routes/fixtures/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const fixtureDataDirectory = "../../resources/fixtures/data";
const fixtureData = [
require(`${fixtureDataDirectory}/area-three-categories-prognosis.json`),
require(`${fixtureDataDirectory}/area-three-categories-y-max.json`),
require(`${fixtureDataDirectory}/area-y-legend-thousand-separator.json`),
require(`${fixtureDataDirectory}/arrow-two-categories-only-negative.json`),
require(`${fixtureDataDirectory}/arrow-two-categories-only-positive.json`),
require(`${fixtureDataDirectory}/arrow-two-categories-same-value.json`),
Expand Down
14 changes: 14 additions & 0 deletions styles_src/q-chart.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
.q-chart {
opacity: 1 !important;

svg {
overflow: visible;
}
}

.q-chart-events {
margin: 0 4px;
display: flex;
flex-direction: row;
align-items: flex-start;
}

.q-chart-events__label {
display: flex;
align-items: center;
margin-left: 4px;
}
8 changes: 8 additions & 0 deletions test/config/toolRuntimeConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,13 @@
"fontSize": 11,
"fontWeight": 700,
"radius": 8
},
"size": {
"width": [
{
"value": 272,
"comparison": "="
}
]
}
}
34 changes: 32 additions & 2 deletions test/dom-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ after(async () => {
server = null;
});

function element(markup, selector) {
function elementAll(markup, selector) {
return new Promise((resolve, reject) => {
const elemArr = [];
const dom = new JSDOM(markup);
resolve(dom.window.document.querySelector(selector));

dom.window.document.querySelectorAll(selector)
.forEach(element => elemArr.push(element));

resolve(elemArr);
});
}

Expand Down Expand Up @@ -83,4 +88,29 @@ lab.experiment("Q chart dom tests", () => {
}
);
});


it("number format of area y legend has correct thousend separator", async () => {
const response = await server.inject({
url: "/rendering-info/web",
method: "POST",
payload: {
item: require("../resources/fixtures/data/area-y-legend-thousand-separator"),
toolRuntimeConfig: toolRuntimeConfig,
},
});
return elementAll(
response.result.markup,
".role-axis-label"
).then((el) => {
const children = el[1].children;
const value0 = children[0].textContent;
const value20000 = children[1].textContent;
const value100000 = children[5].textContent;

expect(value0).to.not.include(" "); // has not quarter space U+2005
expect(value20000).to.include(" "); // has quarter space U+2005
expect(value100000).to.include(" "); // has quarter space U+2005
});
});
});
4 changes: 2 additions & 2 deletions views/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
style="margin: 15px -4px; display: flex; flex-wrap: wrap;"
>
{%- for event in events.data %}
<div style="margin: 0 4px;">
<div class="q-chart q-chart-events">
{% set radius = events.config.radius %}
<svg width="{{ 2 * radius + 2 }}" height="{{ 2 * radius + 2 }}" style="vertical-align: sub;">
<g transform="translate({{ radius + 1 }}, {{ radius + 1 }})">
Expand All @@ -20,7 +20,7 @@
</text>
</g>
</svg>
<span>{{ event.label }}</span>
<span class="q-chart q-chart-events__label">{{ event.label }}</span>
</div style="margin: 0 4px;">
{%- endfor %}
</div>

0 comments on commit 09a0560

Please sign in to comment.