Closed mikima closed 3 years ago
hi @mikima yes, it's possible by just throwing a js error in your render
function
throw new Error("Hello error")
that renders like this:
There was a problem showing the error in the frontend, I just fixed it here https://github.com/rawgraphs/rawgraphs-frontend/commit/9a539ce16c9b794c1675991f94e459b6bc932208 (still needs some styling, but there was a positioning issues and the error was sometimes hidden)
Your specific use case is covered by the dimensions api. When you declare a dimension, you can set minValues and maxValues properties (indipendently) to require/limit the maximum number of values that can be mapped on a multiple dimension. Like:
export const dimensions = [
{
id: 'axes',
name: 'spokes',
validTypes: ['number'],
required: true,
multiple: true,
minValues: 2,
aggregation: true,
aggregationDefault: {
number: 'sum',
string: 'csvDistinct',
date: 'csvDistinct',
},
},
...
]
This should the way to do it but:
Great! Thanks
Is it possible to throw an error from the chart to RAWGraphs interface? For example, in radar chart you should drop at minimum three dimensions to see something. Would be nice to tell it to the user