Advertisement
jmdev

Untitled

Feb 19th, 2015
289
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.93 KB | None
  1. //Define Global Variables
  2. var templater;
  3.  
  4. $( document ).ready(function(){
  5.  
  6. //alert('File is ready.');
  7.  
  8. //Serial chart for both Temperature and Voltage
  9. var serialChart = new SerialChartConfiguration(
  10. 'serialChart', //Chart DIV id
  11. [3], //List of data provider Ids for this chart
  12. { //AmChart Mixins
  13. titles: [{
  14. id: "Title-1",
  15. size: 15,
  16. text: "Test System History"
  17. }],
  18. categoryField: "timestamp",
  19. graphs: [{
  20. title: "Amp", //***
  21. valueAxis: "amp-axis", //***
  22. bullet: "square",
  23. bulletSize: 6,
  24. lineColor: "green",
  25. lineThickness: 1,
  26. negativeLineColor: "red",
  27. type: "smoothedLine",
  28. valueField: "amp" //***
  29. },{
  30. title: "Outside Temperature", //***
  31. valueAxis: "outtemp-axis", //***
  32. bullet: "round",
  33. bulletSize: 6,
  34. lineColor: "blue",
  35. lineThickness: 1,
  36. negativeLineColor: "red",
  37. type: "smoothedLine",
  38. valueField: "out" //***
  39. }],
  40. valueAxes: [{
  41. id: "amp-axes", //***
  42. title: "Amp Axes", //***
  43. position: "left" //***
  44. },{
  45. id: "outtemp-axes", //***
  46. title: "Outside Temp Axes", //***
  47. position: "right"
  48. }],
  49. },{//empty Mango Chart Mixins
  50. },{//Confuguration Mixins
  51. //Multi-series chart so create mappings from point to a graph valueField
  52. dataPointMappings: [{
  53. xidEndsWith: 'amps', //***
  54. valueField: 'amp' //*** map data point to value field on the chart
  55. },{
  56. xidEndsWith: 'outsidetemp', //***
  57. valueField: 'out' //***
  58. }]
  59. });
  60.  
  61. //Setup the Totals Pie Chart
  62.  
  63.  
  64. //Setup the Averages Pie Chart
  65.  
  66.  
  67. //Setup Point Configurations
  68. //Setup a match to both the Voltage and Temperature points to use the same Point Value Data Provider with id 1
  69.  
  70.  
  71. var ampPointValueProvider = new DataPointMatchConfiguration(3, [{matchAttribute: 'name', regex: /Amps/}], {providerType: 'PointValue'});
  72. var outsidetempPointValueProvider = new DataPointMatchConfiguration(3, [{matchAttribute: 'name', regex: /Outside Temp/}], {providerType: 'PointValue'});
  73.  
  74. //Setup a match to both the Voltage and Temperature point to use the same Statistics Data Provider with id 2
  75. //var voltageStatisticsProvider = new DataPointMatchConfiguration(2, [{matchAttribute: 'name', regex: /Voltage/}], {providerType: 'Statistics'});
  76. // var temperatureStatisticsProvider = new DataPointMatchConfiguration(2, [{matchAttribute: 'name', regex: /Temperature/}], {providerType: 'Statistics'});
  77.  
  78. //Setup Group to match the points in the Point Hierarch folder with path /Target Folder/
  79. // this will use the Folder name as the group label
  80.  
  81. var targetFolderGroup = new DataPointGroupConfiguration({
  82. groupBy: 'Folder',
  83. labelAttribute: 'name',
  84. matchConfigurations: [{
  85. matchAttribute: 'path',
  86. regex: /Test Device 1/
  87. }]
  88. });
  89.  
  90.  
  91.  
  92.  
  93. //Setup Templater
  94. var templaterConfig = {
  95. debug: true,
  96. type: 'PointHierarchy',
  97. //Display Configurations for this Templater
  98. displayConfigurations: [serialChart], //, totalsPieChart, averagesPieChart
  99. //Point Match Configurations for this Templater
  100. pointConfigurations: [ampPointValueProvider,outsidetempPointValueProvider],
  101. //Grouping Configurations for this Templater
  102. groupConfigurations: [targetFolderGroup],
  103. //Select Input Configuration for this Templater
  104. groupSelectConfiguration: new SelectPickerConfiguration('groupsList', {options: [{label: 'Select Group', value: '-1'}]}, {styleClass: "ui-btn"}),
  105. }
  106.  
  107. //Create the templater
  108. templater = new DashboardTemplater(templaterConfig);
  109.  
  110. //Can optionally perform action when templater is ready by using the Deferred Promise of the Templater
  111. $.when(templater.deferred.promise).then(function(){ alert('Templater is ready.')});
  112.  
  113. });// End When page Ready
Advertisement
RAW Paste Data Copied
Advertisement