 CSV Dumper 

<TMPL_LOOP name="inverters">

 Filename: <TMPL_VAR name="CSVDumper::Filename" /> 

 <TMPL_VAR name="Inverter Name" /> 

<TMPL_VAR name="Inverter Manufactor" /> 
 <TMPL_VAR name="Inverter Model" /> 

 LoggedCapas: <TMPL_VAR name="CSVDumper::LoggedCaps" />
</TMPL_LOOP>  

<* First emit the header of the script *>
 
var timeplot;
function onLoad() {

    window.onresize=onResize;
 var timeGeometry = new Timeplot.DefaultTimeGeometry({
    gridColor: new Timeplot.Color("#000000"),
    axisLabelsPlacement: "top"  });
    
 var valueGeometry = new Timeplot.DefaultValueGeometry({
    gridColor: "#000000",
    axisLabelsPlacement: "left"
  });

  var valueGeometry2 = new Timeplot.DefaultValueGeometry({
    gridColor: "#000000"
  });
    
<* we need a eventsource for every inverter having a CVSDumper attached. We know by looking 
at the capa for the filename. *>
<TMPL_LOOP name="inverters">
    <TMPL_IF name="CSVDumper::Filename">
    var eventSource<TMPL_VAR name="iteration"/> = new Timeplot.DefaultEventSource();    
    </TMPL_IF>
</TMPL_LOOP>  
 
<* here's the tricky part. creating the timeplot infos. *> 
var plotInfo = [
<TMPL_LOOP name="inverters">
<TMPL_IF name="CSVDumper::Filename">
Timeplot.createPlotInfo({
    <TMPL_IF name="iteration" value="0"><TMPL_ELSE/>,</TMPL_IF>
    id: "plot1_<TMPL_VAR name="iteration"/>",
    dataSource: new Timeplot.ColumnSource(eventSource<TMPL_VAR name="iteration"/>,<TMPL_VAR name="powernow"/>),
    valueGeometry: valueGeometry,
    timeGeometry: timeGeometry,
    <TMPL_IF    name="iteration" value="0"  > lineColor: "#0000ff", fillColor: "#a0a0ff",
    <TMPL_ELSIF name="iteration" value="1" /> lineColor: "#00ff00", fillColor: "#a0ffa0",
    <TMPL_ELSIF name="iteration" value="2" /> lineColor: "#ff0000", fillColor: "#ffa0a0",
    </TMPL_IF>
    showValues: true,
    roundValues: false
    })
</TMPL_IF>   
</TMPL_LOOP>   

<TMPL_LOOP name="inverters">
<TMPL_IF name="CSVDumper::Filename">
,Timeplot.createPlotInfo({
    id: "plot2_<TMPL_VAR name="iteration"/>",
    dataSource: new Timeplot.ColumnSource(eventSource<TMPL_VAR name="iteration"/>,<TMPL_VAR name="kwhtoday"/>),
    valueGeometry: valueGeometry2,
    timeGeometry: timeGeometry,
    <TMPL_IF    name="iteration" value="0"  > lineColor: "#0000ff",
    <TMPL_ELSIF name="iteration" value="1" /> lineColor: "#00ff00", 
    <TMPL_ELSIF name="iteration" value="2" /> lineColor: "#ff0000",
    </TMPL_IF>
    showValues: true,
    roundValues: false
    })
</TMPL_IF>   
</TMPL_LOOP>
    
];

timeplot = Timeplot.create(document.getElementById("csvtimeplot"), plotInfo);
<TMPL_LOOP name="inverters">
<TMPL_IF name="CSVDumper::Filename">
  timeplot.loadText("<TMPL_VAR name="CSVDumper::Filename">", ",", eventSource<TMPL_VAR name="iteration"/>);
</TMPL_IF>  
</TMPL_LOOP>    
 }

var resizeTimerID = null;
function onResize() {
    if (resizeTimerID == null) {
        resizeTimerID = window.setTimeout(function() {
            resizeTimerID = null;
            timeplot.repaint();
        }, 100);
    }
}

