Skip to content

Commit

Permalink
Merge pull request #152 from nzzdev/release-3.0.1
Browse files Browse the repository at this point in the history
Release 3.0.1
  • Loading branch information
benib authored Oct 11, 2019
2 parents ad09240 + a0740fa commit 582ab5d
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 18 deletions.
3 changes: 2 additions & 1 deletion chartTypes/arrow/vega-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@
"grid": true,
"ticks": true,
"tickCount": 6,
"labelSeparation": 4
"labelSeparation": 4,
"labelOverlap": "parity"
},
{
"orient": "left",
Expand Down
3 changes: 2 additions & 1 deletion chartTypes/dotplot/vega-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@
"labels": true,
"ticks": true,
"tickCount": 6,
"labelSeparation": 4
"labelSeparation": 4,
"labelOverlap": "parity"
},
{
"orient": "left",
Expand Down
6 changes: 2 additions & 4 deletions config/d3.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ module.exports = {
formatLocale: {
decimal: ",",
thousands: " ", // this is a viertelgeviert U+2005
grouping: undefined,
grouping: [3],
type: " ",
// minus: "−" // U+2212 minus sign
minus: "–" // U+2013
// "currency": ["", "\u00a0CHF"],
},
formatLocaleNoGrouping: {
decimal: ",",
thousands: " ", // this is a viertelgeviert U+2005
grouping: [3],
grouping: undefined,
type: " ",
minus: "–" // U+2013
// "currency": ["", "\u00a0CHF"],
},
timeFormatLocale: {
dateTime: "%A, der %e. %B %Y, %X",
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.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "q-chart",
"version": "3.0.0",
"version": "3.0.1",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -12,6 +12,7 @@
"license": "MIT",
"dependencies": {
"@hapi/boom": "^8.0.1",
"@hapi/bourne": "^1.3.2",
"@hapi/hapi": "^18.4.0",
"@hapi/hoek": "^8.3.0",
"@hapi/inert": "^5.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"B"
],
[
"A",
"A pretty long label",
"1000",
"-1000"
],
[
"B",
"B also a pretty long label",
"200",
"200"
]
Expand Down
36 changes: 28 additions & 8 deletions routes/rendering-info/web-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,26 @@ async function getSvg(id, request, width, item, toolRuntimeConfig = {}) {
return svg;
}

// extend Joi to support string object string coercion (see https://github.com/hapijs/joi/issues/2037 and https://github.com/hapijs/joi/blob/master/API.md#extensions)
// this is needed for toolRuntimeConfig in the query string
const Bourne = require("@hapi/bourne");
const customJoi = Joi.extend({
type: "object",
base: Joi.object(),
coerce: {
from: "string",
method(value, helpers) {
if (value[0] !== "{" && !/^\s*\{/.test(value)) {
return;
}

try {
return { value: Bourne.parse(value) };
} catch (ignoreErr) {}
}
}
});

module.exports = {
method: "POST",
path: "/rendering-info/web-svg",
Expand All @@ -188,15 +208,15 @@ module.exports = {
options: {
allowUnknown: true
},
query: Joi.object({
width: Joi.number().required(),
noCache: Joi.boolean(),
toolRuntimeConfig: Joi.object(),
id: Joi.string().required()
query: customJoi.object({
width: customJoi.number().required(),
noCache: customJoi.boolean(),
toolRuntimeConfig: customJoi.object().optional(),
id: customJoi.string().required()
}),
payload: Joi.object({
item: Joi.object(),
toolRuntimeConfig: Joi.object()
payload: customJoi.object({
item: customJoi.object(),
toolRuntimeConfig: customJoi.object()
})
}
},
Expand Down

0 comments on commit 582ab5d

Please sign in to comment.