History Report Chart



  History report chart is a widget that prints the data as a form of minutely, hourly, daily, monthly, and annually.


 Users can do the following tasks using history report chart scripts.


    1. It is able to obtain the report data by setting the type of data to display on the report chart.


    1. It is able to obtain the data of the day selected on the report chart.


    1. It is able to obtain various data on a graph by changing the name of data on the graph.
    2. It is able to obtain the value of data displayed on the graph through getGraphDate.
    3. Display the data of the selected period.

     

         

                               



Methods



 History report chart widget object provides the following scripts.

 Scripts for the History report chart is the same as for the Data chart. Refer to the [Data Chart] function.


Return type

Method

Description


addBarData( name, value )

Add a bar graph data to the chart.


addCurveData( name, value )

Add a curve graph data to the chart.


addSeriesData( name, value )

Add a line graph data to the chart.


moveToY2Scale( name )

Enter the name of graphs to use the right Y-axis.


setBarChartStyle( style )

Set the style of bar graphs to the chart.


setBarColor( name, color )

Set the line color of bar graphs to the chart.


setBarSpacing( width )

Set the space of bar graphs to the chart.


setDataVisible( index, visible )

Reveal or hide the graph.


setLineColor( name, color )

Set the line color of line graphs to the chart.


setLineStyle( name, style )

Set the line style of line graphs to the chart.


setLineWidth( name, width )

Set the line width of line graphs to the chart.


setY2Range( min, max, step )

Set the range and space of the right Y-axis to the chart.


setYRange( min, max, step )

Set the range and space of the Y-axis to the chart.



 History report chart provides the following functions.


Return Type

Method

Description

list[float]

getGraphData( name )

Read the data displayed on the graph.


loadData( kind )

Read the report data (Select minute, hour, day, month, year)


loadDataThisTime( year, month, day, hour )

Read the data of the entered date and print it on the widget.


loadReport( syear, smonth, sday, shour

            eyear, emonth, eday, ehour )

Read the data of the selected period. (Select minute, hour, day, month, year)


loadReport( kind , syear, smonth, sday, shour

            eyear, emonth, eday, ehour )

Read the data of the entered date by selecting the report data. (Select minute, hour, day, month)


replaceText( replacelist )

Change the name of the selected data and print various data on one graph.




  loadDataThisTime( year:Year, month:Month, day:Day, hour:Hour )

 

  Read the data of the entered period and prints it on the widget.



  Example)

   


       d = canvas.getObject('dateWidget')   # Obtain the date widget.

       chart = canvas.getObject('HistoryReportChart')   # Obtain the history report chart widget.


       # Read the date and print it on the history report chart widget.

       chart.loadDataThisTime(d.getYear(),d.getMonth(),d.getDay(),0)




 



  loadData( kind )

 

  loadData reads the selected history data, and print it on the graph of the history report chart widget.


   Enter the type of historical data to print.

          - HistoryDataReportChartItem.Minute : Minute data

          - HistoryDataReportChartItem.Hour : Hour data

          - HistoryDataReportChartItem.Day : Day data

          - HistoryDataReportChartItem.Month : Month data

          - HistoryDataReportChartItem.Year : Annual data



  Example)

   


       chart = canvas.getObject('HistoryReportChart')   # Obtain the history report chart widget.

       data = chart.loadData( chart.Minute )   # Print the minute data.

       data = chart.loadData( chart.Hour )   # Print the hour data.





  list[float] getGraphData( name:Data name )

 

  Read the data printed on the graph.


  ㆍ name : Enter the name of graphs set to the history data chart widget.


 



  Example)

   


       chart = canvas.getObject('HistoryReportChart')   # Obtain the history report chart widget.

       print chart.getGraphData('ESS Charge')   # Read 'ESS Charge' printed on the history report chart widget.





  Output)

   

      (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 34.0, 70.0, 192.0, 122.0, 197.0, 192.0, 145.0, 68.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)




  replaceText( replaceList )

 

  replaceText is used to change the data name and print various data on one graph widget.

  If the [Lighting] button is clicked, it reads the data corresponding to the toilet, if the [Outlet] button is clicked. it reads the data corresponding to the office.


 


 If you want to use replaceText, pre-set the name through scripts as below. If you set the String to $1,$2 as below, it is able to call the data by replacing $1,$2 to the desired text.

 


  •  The form of replaceName is as follows.

    -> ['Replace text:Current text', 'Replace:Current text', ···]



  Example)

   


       chart = canvas.getObject('HistoryReportChart')   # Obtain the history report chart widget.

       chart.replaceText(['$1:Lighting#1', '$2:Lighting'])  # Replace '$1', '$2' with 'Lighting#1' , 'Lighting' respectively.







  loadReport( syear:State year, smonth:Start month, sday:Start day, shour:Start hour,

                  eyear:End year, emonth:End month, sday:End day, shour:End hour )

 

  Read the report data of the selected period by selecting the start date and the end date.

  Types differ according to the selected period, Types are as follows.


  • Within a month : The hourly report data is read.
  • For more than a month to less than a year : The daily report data is read.
  • For more than a year to less than 5 years : The monthly report data is read.
  • For more than 5 years : The annually report data is read.

 

   

  Example)

   


       chart = canvas.getObject('HistoryReportChart')   # Obtain the history report chart widget.

       start = canvas.getObject('startDateTime')  # Read the selected start date on the date widget.

       end = canvas.getObject('endDateTime')  # Read the selected end date on the date widget.


       # Read the data of the selected period and display it on the report chart widget.

       chart.loadReport(start.getYear(), start.getMonth(), start.getDay(), 0, end.getYear(), end.getMonth(), end.getDay(), 0)




  Result)

 



  loadReport( kind:Report type, syear:Start year, smonth:Start month, sday:Start day, shour:Start hour,

                  eyear:End year, emonth:End month, eday:End day, ehour:End hour )

 

  Read the report data of the selected period by selecting the start date and the end date.

  When reading data, select the type of reports.

 

    dataKind: Enter the type of historical data to display.

          - HistoryDataReportChartItem.Minute : Minute data

          - HistoryDataReportChartItem.Hour : Hour data

          - HistoryDataReportChartItem.Day : Day data

          - HistoryDataReportChartItem.Month : Month data

          - HistoryDataReportChartItem.Year : Year data


     

  Example)

   


       chart = canvas.getObject('HistoryReportChart')   # Obtain the history report chart widget.

       start = canvas.getObject('startDateTime')  # Read the selected start date on the date widget.

       end = canvas.getObject('endDateTime')  # Read the selected end date on the date widget.


       # Read the day report data of that period and display it on the history report chart widget.

       chart.loadReport(chart.Day ,  start.getYear(), start.getMonth(), start.getDay(), 0, end.getYear(), end.getMonth(), end.getDay(), 0)




  Results)