I am interested in using the number of shifts per activity. I believe this is in XDATA GEARS Front-NUM. How can I add a field to report the number of shifts for front and number of shifts for rear derailleurs in the activity? I'm not interested in how long I used each gear or anything else, just the number of shifts made with each derailleur.I did a search and found info about XDATA and shift graph. I followed the links re XDATA, but either I didn't understand it or it didn't cover what I am looking for.
In the User Chart, time values on the Y-axis can only be displayed in decimal format (not as 01:04:02).
Make sure that under Chart Settings → Axis, the Minutes setting is set to Continuous.
Otherwise, the User Chart will display nothing. https://github.com/GoldenCheetah/GoldenCheetah/wiki/UG_Special-Topics_Working-with-User-Charts#axis-settings
Gear Ratio Shifts tile is the Y units wrong must be Quantity.
Unfortunately, the store() and fetch() functions do not work reliably across different tiles. Each time GC is started, the tile that receives data via fetch() is empty.And when data is then displayed, it is not that of the currently selected activity.
Thank you for the hint. That fixes the issue of incorrect data being loaded. What it doesn't solve is that the activity does not store any data in store() the first time it is loaded, and the activity always needs to be loaded twice for store() to have data.
I must have done something wrong. I can't reproduce the problem. I created a new overview with the two user chart tiles and it works as expected. The code was simply copied from the tiles that did not work. I have attached the overview where it doesn't work.
It's the order in which the charts appear in the .gchart file that makes
the difference between working and non- working versions.
I've tested it by editing the .gchart file in a text editor. Basically
reordering the values in the "config:" section by copy&pasting the
strings results in a working chart.
my-variable-name <- "my-variable-name"+filename();
if (fetch( my-variable-name )=0) store(my-variable-name , some-lengthy-computation-generating-a-numeric-value);
{
relevant
{
if(length(xdata("GEARS","FRONT-NUM")) = 0)
{annotate(label,"No Gear data in this activity available."); }
else
{ xdata("GEARS","FRONT-NUM"); }
}
finalise
{
# --- Get Data ---
gearsFrontNum <- xdata("Gears", "Front-Num");
count(gearsFrontNum[ i>0 && gearsFrontNum[i-1]<>gearsFrontNum[i] ]);
}
}
A little more background on why I am attempting to obtain the number of shifts. I want to use this number along with the interval between charges to monitor battery degradation as a function of decreasing number of shifts between charges. I have read and reread "UG_Special Topics_Formula Syntax and Expressions", unfortunately, I don't understand a fair amount of it. I have no computer programming/language background. I am trying to learn, but so far it is really frustrating. I think I understand the basic premise of what needs to be done, but fail miserably on how to accomplish it.My understanding is that shift data is stored in Raw Data -> GEARS -> "FRONT-NUM" AND "REAR-NUM". Additionally, this data is in XDATA(Front-Num) and XDATA(Rear-Num) . The data is a vector? In order to obtain the desired number of shift for the front derailleur, I need to count the number of times the value in Front-Num changes. Beyond that I am kind of lost. I'm not sure if I do this by creating a custom metric as below (which doesn't appear to work) or some other option. I copied the first section from the "Shimano DI2.gchart" so to only run the data if Front-Num contains data. The rest is my fumbling about. I'm trying to limit how much I ask for help, but I am really lost at the moment and need more guidance{
relevant
{
if(length(xdata("GEARS","FRONT-NUM")) = 0)
{annotate(label,"No Gear data in this activity available."); }
else
{ xdata("GEARS","FRONT-NUM"); }
}
finalise
{
# --- Get Data ---
gearsFrontNum <- xdata("Gears", "Front-Num");
count(gearsFrontNum[ i>0 && gearsFrontNum[i-1]<>gearsFrontNum[i] ]);
}
}
#Rear Shifts
{
RDNum <- xdata("Gears", "Rear-Num");
count(RDNum[ i>0 && RDNum[i-1]<>RDNum[i] ]);
}
I'm not sure what I'm doing wrong, I set up a Rear Shifts kpi with this (I changed the name but otherwise the same but the value is always "1". Front is the same except FD replaced RD.