Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Define Global Variables
- var templater;
- $( document ).ready(function(){
- //alert('File is ready.');
- //Serial chart for both Temperature and Voltage
- var serialChart = new SerialChartConfiguration(
- 'serialChart', //Chart DIV id
- [3], //List of data provider Ids for this chart
- { //AmChart Mixins
- titles: [{
- id: "Title-1",
- size: 15,
- text: "Test System History"
- }],
- categoryField: "timestamp",
- graphs: [{
- title: "Amp", //***
- valueAxis: "amp-axis", //***
- bullet: "square",
- bulletSize: 6,
- lineColor: "green",
- lineThickness: 1,
- negativeLineColor: "red",
- type: "smoothedLine",
- valueField: "amp" //***
- },{
- title: "Outside Temperature", //***
- valueAxis: "outtemp-axis", //***
- bullet: "round",
- bulletSize: 6,
- lineColor: "blue",
- lineThickness: 1,
- negativeLineColor: "red",
- type: "smoothedLine",
- valueField: "out" //***
- }],
- valueAxes: [{
- id: "amp-axes", //***
- title: "Amp Axes", //***
- position: "left" //***
- },{
- id: "outtemp-axes", //***
- title: "Outside Temp Axes", //***
- position: "right"
- }],
- },{//empty Mango Chart Mixins
- },{//Confuguration Mixins
- //Multi-series chart so create mappings from point to a graph valueField
- dataPointMappings: [{
- xidEndsWith: 'amps', //***
- valueField: 'amp' //*** map data point to value field on the chart
- },{
- xidEndsWith: 'outsidetemp', //***
- valueField: 'out' //***
- }]
- });
- //Setup the Totals Pie Chart
- //Setup the Averages Pie Chart
- //Setup Point Configurations
- //Setup a match to both the Voltage and Temperature points to use the same Point Value Data Provider with id 1
- var ampPointValueProvider = new DataPointMatchConfiguration(3, [{matchAttribute: 'name', regex: /Amps/}], {providerType: 'PointValue'});
- var outsidetempPointValueProvider = new DataPointMatchConfiguration(3, [{matchAttribute: 'name', regex: /Outside Temp/}], {providerType: 'PointValue'});
- //Setup a match to both the Voltage and Temperature point to use the same Statistics Data Provider with id 2
- //var voltageStatisticsProvider = new DataPointMatchConfiguration(2, [{matchAttribute: 'name', regex: /Voltage/}], {providerType: 'Statistics'});
- // var temperatureStatisticsProvider = new DataPointMatchConfiguration(2, [{matchAttribute: 'name', regex: /Temperature/}], {providerType: 'Statistics'});
- //Setup Group to match the points in the Point Hierarch folder with path /Target Folder/
- // this will use the Folder name as the group label
- var targetFolderGroup = new DataPointGroupConfiguration({
- groupBy: 'Folder',
- labelAttribute: 'name',
- matchConfigurations: [{
- matchAttribute: 'path',
- regex: /Test Device 1/
- }]
- });
- //Setup Templater
- var templaterConfig = {
- debug: true,
- type: 'PointHierarchy',
- //Display Configurations for this Templater
- displayConfigurations: [serialChart], //, totalsPieChart, averagesPieChart
- //Point Match Configurations for this Templater
- pointConfigurations: [ampPointValueProvider,outsidetempPointValueProvider],
- //Grouping Configurations for this Templater
- groupConfigurations: [targetFolderGroup],
- //Select Input Configuration for this Templater
- groupSelectConfiguration: new SelectPickerConfiguration('groupsList', {options: [{label: 'Select Group', value: '-1'}]}, {styleClass: "ui-btn"}),
- }
- //Create the templater
- templater = new DashboardTemplater(templaterConfig);
- //Can optionally perform action when templater is ready by using the Deferred Promise of the Templater
- $.when(templater.deferred.promise).then(function(){ alert('Templater is ready.')});
- });// End When page Ready
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement