Reputation: 21
My problem is the index.json
{
"data": [
{
"id": "concepts",
"label": "Fields",
"elements": [
{
"id": "dim",
"label": "label, quadrant, ring, link, active, moved",
"type": "DIMENSION",
"options": {
"min": 6,
"max": 6
}
}
]
}
],
"style": [
...here is unrelated code...
{
"id": "offsets",
"label": "Legend-Offset in pixel",
"elements": [
{
"id": "offset_0",
"label": "Offset_0 (-500 to 500)",
"type": "INTERVAL"
},
{
"id": "offset_1",
"label": "Offset_1 (-500 to 500)",
"type": "INTERVAL"
},
{
"id": "offset_2",
"label": "Offset_2 (-500 to 500)",
"type": "INTERVAL"
},
{
"id": "offset_3",
"label": "Offset_3 (-500 to 500)",
"type": "INTERVAL"
}
]
}
]
}
In the config reference it's said, that an interval needs to have this form:
And should have an options object.
This means the elements of style should look like that:
{
"id": "offset_3",
"label": "Offset_3 (-500 to 500)",
"type": "INTERVAL",
"defaultValue": 0,
"options": {
"min": -500,
"max": 500
}
}
And that is how the dscc-scripts validation wants it to look like:
{
"id": "offset_3",
"label": "Offset_3 (-500 to 500)",
"defaultValue": "0",
"type": "TEXTINPUT"
}
Sadly doing the "should be" blows up the dscc-scripts, with errors telling me, that there should be no options and that defaultValue needs to be a string.
Well, doing it as seen in the last code snip fixes this problem and I can indeed build and push my code to the google storage bucket, sadly that won't help me at all as now Data Studio (Browser) blows out errors, telling me that "interval" values need to be of type numbers.
Any idea as how to fix that?
Upvotes: 0
Views: 140
Reputation: 21
I found a better solution than using type: "TEXTFIELD":
Just changed the schemas the dscc-scripts package uses to fit the homepage. (so I changed it from string to number) I don't really get why they would not do that themselves since they changed types from string to numbers, but nvm that.
Here what I changed in schemas.js (node_modules/@google/dscc-scripts/builds/viz/schemas.js):
(See type under defaultValue...)
...
interval: {
type: 'object',
additionalProperties: false,
required: ['id', 'label', 'type'],
properties: {
id: { type: 'string' },
label: { type: 'string' },
type: {
type: 'string',
enum: ['INTERVAL'],
},
defaultValue: { type: 'number' },
},
},
...
#QuestionClosed
Upvotes: 1