So I saw this post and I was wondering how the structure in your attached linked works.
I have a pretty weird data structure coming from my backend and I'm not exactly sure how to slot all of that data in the structure you have.
So I have an array with a bunch of objects, each object looks like this :
data: {
"plot_info": {
"max": "40",
"median": "20",
"min": "0",
"plot_type": "box_plot",
"q1": "15",
"q3": "25",
"unit": "Mpa"
},
"value": {
"real_value": [ '22', '22', '22', '20', '10', '38', '28', '12', '34', '11', '27' ], // This continues with a total of lets say 100 numbers
"status": "warning"
},
"anomaly_data": {
"pt1": {
"status": "abnormal",
"time": "05/23/2022 15:50:00",
"value": 45
},
"pt2": {
"status": "warning",
"time": "05/23/2022 15:51:00",
"value": -1
}
},
},
So all 3 of these objects are going to help me build out my boxplot chart. First, the plot_info
is all of the boxplot data that the backend provides me, like the question linked from early March; there are some bits of data we don't need (plot_type and unit).
Second, the value.real_value
is all of the values in an array (status doesn't matter here). Finally, anomaly_data.value
is our outliers.
I am a bit lost on how to get this data to actually filter into the boxplot chart properly using the format you linked in the previous question:
data: [
[1, 2, 3, 4, 5],
{
min: 1,
q1: 2,
median: 3,
q3: 4,
max: 5,
},
{
min: 1,
q1: 2,
median: 3,
q3: 4,
max: 5,
items: [1, 2, 3, 4, 5],
},
{
min: 1,
q1: 2,
median: 3,
q3: 4,
max: 5,
outliers: [1, 2, 3, 4, 5],
},
],
This is all in one dataset, yet there are 3 objs with min, q1, median, q3, max, items
; some of which have items
, outliers
or nothing at all. I figured the first array of [1, 2, 3, 4, 5]
would be my value.real_value
, but now I'm not so sure.
Context
- Version: "^3.7.2"
- Browser: chrome
This is in a vue3 project, but using largely JS for boxplot charts.
Additional context
I made a Codesandbox for this example and am trying to work with it, but so far, no luck. Any ideas or advice would be greatly appreciated. Again, thank you for all your help so far and I look forward to hearing back soon!