Reputation: 11
after hours of searching in the internet and endless trys I decided to post my problem in this forum.
I have to admit that I am a really bad devoloper. I try always to find code which I change to adept to my needs.
In this case I was not able to find anything suitable and the documentation from google could be also better.
Therefore I would be very happy if someone of the gifted programmers in this forum could help me.
My code is actual looking like this:
var sheet_vokabeln = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Vokabeln");
var sheet_Magnetkupplung = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Magnetkupplung");
var sheet_kennlinie = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Kennlinie");
var sheet_kennliniendaten = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Kennliniendaten");
var text_y_achse_Foerderhoehe = sheet_kennliniendaten.getRange("I62").getValue();
var text_y_achse_npsh = sheet_kennliniendaten.getRange("I63").getValue();
var text_menge = sheet_kennliniendaten.getRange("B49").getValue();
var text_P2 = sheet_kennliniendaten.getRange("I65").getValue();
var text_wirkungsgrad = sheet_kennliniendaten.getRange("I66").getValue();
var minmenge = sheet_Magnetkupplung.getRange("I35").getValue();
var maxmenge = sheet_Magnetkupplung.getRange("J35").getValue();
var anzahl_messpunkte_kalt = sheet_kennliniendaten.getRange("I67").getValue()+62;
var anzahl_messpunkte_warm = sheet_kennliniendaten.getRange("I68").getValue()+62;
var anzahl_messpunkte_npsh = sheet_kennliniendaten.getRange("I69").getValue()+63;
var range_warm = sheet_kennliniendaten.getRange("B62:C"+anzahl_messpunkte_warm);
var range_kalt = sheet_kennliniendaten.getRange("D62:D"+anzahl_messpunkte_kalt);
var range_npsh = sheet_kennliniendaten.getRange("E62:E"+anzahl_messpunkte_npsh);
var range_P2warm = sheet_kennliniendaten.getRange("K62:L"+anzahl_messpunkte_warm);
var range_P2kalt = sheet_kennliniendaten.getRange("M62:M"+anzahl_messpunkte_kalt);
var range_eff = sheet_kennliniendaten.getRange("N62:N"+anzahl_messpunkte_warm);
var hmax = sheet_kennliniendaten.getRange("I70").getValue();
var xparameters = {
"title": text_menge,
"fontName":"Arial",
"minValue":minmenge,
"maxValue":maxmenge,
"titleTextStyle": {
"color": "#c0c0c0",
"fontSize": 10,
"fontName":"Roboto",
"italic": true,
"bolt": false
}
};
var y1parameters = {
"title": text_y_achse_Foerderhoehe,
"fontName":"Arial",
"minValue":0,
"maxValue":hmax,
"titleTextStyle": {
"color": "#c0c0c0",
"fontSize": 10,
"fontName":"Roboto",
"italic": true,
"bolt": false
}
};
var y2parameters = {
"title": text_y_achse_npsh,
"fontName":"Arial",
"minValue":0,
"maxValue":10,
"titleTextStyle": {
"color": "#c0c0c0",
"fontSize": 10,
"fontName":"Roboto",
"italic": true,
"bolt": false
}
};
var chart = sheet_kennlinie.getCharts()[0];
var old_ranges_oben = chart.getRanges();
for (var i in old_ranges_oben) {
var bereich = old_ranges_oben[i];
chart = chart.modify()
.removeRange(bereich)
.build();
}
chart = chart.modify()
.addRange(range_warm)
.addRange(range_kalt)
.addRange(range_npsh)
.setOption('vAxis'[0], y1parameters)
.setOption('vAxis'[1], y2parameters)
.setOption('hAxis',xparameters)
.setOption('width', 636)
.setOption('height', 391)
.setOption('legend', {position: 'up', textStyle: {fontSize: 12}})
.setPosition(10,1,2,1)
.build();
sheet_kennlinie.updateChart(chart);
the problem is that the code does not change the properties of the y-axes. Furthermore the legend is not shown. there is no error message.
Does anyone could help please!
thanks in advance klusek
Upvotes: 0
Views: 32
Reputation: 11
ok after another 4 h waste of time and with help of one professional we came a little step forward.
The code snippet inside for the vAxes is looking like this now:
.setOption('vAxes', {
vAxes:{
0: y1parameters,
1: y2parameters
},
series:{
0: {
targetAxisIndex: 0
},
1: {
targetAxisIndex: 1
},
},
})
The title of the vAxes are now deleted and this is a little bit more than nothing but already not the target.
Does anyone knows the solution?
Upvotes: 1