Hi all .
I have problem with chart.
I search solution and find it .. .
In chart builder make complete chart (design) what I want with all data 
sources .
Then start script editor and make new file. Make script :

function UpdateEnergia48() {
  var spreadsheet = SpreadsheetApp.openById('your ID');
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Graf  Energie'), 
true); 
// here write name your sheet where chart is 
  var sheet = spreadsheet.getActiveSheet();
  var charts = sheet.getCharts();
  var chart = charts[charts.length - 1].modify()
  .clearRanges()
  .addRange(spreadsheet.getRange('\'Hárok1\'!A1:A49')) // here define 
source  for all range what I need  Hárok1 is in Slovak Language , in 
english is sheets , for example ('\'Sheet1\'!A1:A49')) , or name of your 
Sheets
  .addRange(spreadsheet.getRange('\'Hárok1\'!S1:S49'))
  .addRange(spreadsheet.getRange('\'Hárok1\'!T1:T49'))
  .addRange(spreadsheet.getRange('\'Hárok1\'!U1:U49'))
  .addRange(spreadsheet.getRange('\'Hárok1\'!D1:D49'))
  .build();
  sheet.updateChart(chart);
};
after this work perfect, lots of help me macro record.. then I see code and 
can edit it .
If all finish then make time event every 15 minutes start my script 
UpdateEnergia48() and data are updated ..
With this code you can make google web page with chart and public it .. 
work good ..
Dátum: štvrtok 12. augusta 2021, čas: 10:23:16 UTC+2, odosielateľ: Ševc 
Dominik

> Hi all .
> I have easy project, make own electronics with sensors (temperature, water 
> sensor, energy ). All this data are stored to spreadsheet . 
> I have two spreadsheet 
> 1. record all data in all time 
> 2. spreadsheet for last 48 hour .
> Here is part of script :
> var newRow_48 = sheet_48.getLastRow();
> if (newRow_48 > 48) sheet_48.deleteRow(2);              
> newRow_48 = sheet_48.getLastRow() + 1; 
> var newRange_48 = sheet_48.getRange(newRow_48, 1, 1, rowData.length); 
> newRange_48.setValues([rowData]); 
> On first find last row , then if more then 48 , delete row 2 , then append 
> data to last row .
> All working perfect , for 100%
> Here is link to my spreadsheet : last 48 hour 
> <https://docs.google.com/spreadsheets/d/1qE9pPDPf4ej8JSz59qG15z4bSRSzYPw_NR2xuw2T0BQ/edit?usp=sharing>
>  
>       
> I create chart on new sheet , 
> 1.Graf Energie
> 2.Graf Voda
>
> I set all what I want , and show me all data what I want .
>
> Problem : 
> 1. I set range from 1:49 
> for example A1:A49 
> but after some time range change from 1:49 to 1:49 , then 1:47 etc .. 
> not only in A1:A49 , also all other range D1:D49 , S1:S49
> what is problem??
>
> I know I reload all data in my last 48 hour spreadsheet . 
> delete  row 2 and then write new data to last row ..
>
> what is problem .. 
>
> regards ..
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/c3e9ba5f-2f40-4a9b-918e-2cf32627a72fn%40googlegroups.com.

Reply via email to