This was a fantastic skeleton, thanks
added to the intervals chart as background zones
will add to the 30 min block chart (but colour the bars) shortly
This was a fantastic skeleton, thanks
added to the intervals chart as background zones
will add to the 30 min block chart (but colour the bars) shortly
If someone has time and skills, I would love to get the kilometers spent per Gratient custom cart (e.g. 10km above 8% grade, 5km above 10% grade etc.)
Iâm looking for something similar
In my case, I want to put the VAM in perspective of zones, for example, how long the athlete stays in each ascent measure divided by 100 units.
Some types of charts only make sense for certain types of activities (e.g. run activities, activities with power, activities with at least one interval, activities with certain custom streams etc.).
Perhaps there should be a way to signal âdonât draw this chart for this activityâ. Either simply not setting a value for chart
or setting a value containing a reason - or error message.
(posted in the wrong thread first, so now I have to put some more text so theyâre not similar)
Thats a good idea. If the script does not return a value or returns null then the chart is hidden completely when displayed on an activity. Unfortunately you canât use âreturnâ in these scripts without defining a function and invoking it:
function chart() {
if (true) return // not the right type of activity or whatever
// your chart code
return { data: [], layout: { title: { "Hello" } } }
}
chart()
If you are editing the chart script then you will see âScript did not return a value objectâ instead of just blank.
Iâve been using labeled blocks to get around that, and around excessive nesting - see break in labeled blocks.
I think the function approach is a bit less exotic but this seems to work too. Iâm not sure how youâve implemented the sandbox so not sure if thereâs any advantages to any approach.
I didnât know about those, thanks:
out: {
if (true) break out; // not the right type of activity or whatever
// your chart code
let chart = { data: [] }
chart
}
This also creates unexpected behaviour as Plotly disregards Text values in the x-array when numbers are present. If some work intervals do not have a label, only those will be plotted and the intervals with a text label will not be shown.
I havenât found a way yet to tell Plotly that it needs to interpret the whole x-array as text values, so I came up with this intermediate solution:
x.push("°" + (iv.label ? c + "-" + iv.label : c))
The ° sign as first character, makes sure that all values in the x-array are considered as text values.
You can remove that and just include this in the layout options:
layout = {
...
xaxis:{"type": "category"}
}
Thanks for that tip!
Works like a charm.