Advertisement
cornford-michael

Untitled

Jun 11th, 2023
1,033
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const formatterCustom = {
  2.   formatter: (obj) => {
  3.     return obj.value.toLocaleString("en-US", {
  4.       minimumFractionDigits: 2,
  5.       maximumFractionDigits: 4,
  6.     });
  7.   },
  8. };
  9.  
  10. var a = [
  11.       {
  12.         title: "Main Steam Press.",
  13.         plot: [
  14.           {
  15.             value: "Main Steam Press.",
  16.             connectnulldata: true,
  17.             style: {
  18.               plot: {
  19.                 "stroke-dasharray": "5 2",
  20.               },
  21.             },
  22.           },
  23.         ],
  24.         referenceLine: [],
  25.         format: {
  26.           suffix: "MPa",
  27.           defaultFormat: 0,
  28.           round: "1",
  29. //           ...formatterCustom,
  30.         },
  31.         type: "line",
  32.         orientation: "left",
  33.       },
  34.       {
  35.         title: "Gross Output",
  36.         plot: [{ value: "Gross Output", connectnulldata: true }],
  37.         referenceLine: [],
  38.         format: {
  39.           suffix: "MW",
  40.           defaultFormat: 0,
  41.           round: "1",
  42. //           ...formatterCustom,
  43.         },
  44.         style: {
  45.           title: { "font-size": "10px" },
  46.           "plot.null": {
  47.             "stroke-dasharray": "5",
  48.           },
  49.         },
  50.         type: "line",
  51.         orientation: "left",
  52.       },
  53.       {
  54.         title: "ST Speed",
  55.         plot: [
  56.           {
  57.             value: "ST Speed",
  58.             connectnulldata: true,
  59.             style: {
  60.               plot: {
  61.                 "stroke-dasharray": "5 2",
  62.               },
  63.             },
  64.           },
  65.         ],
  66.         referenceLine: [],
  67.         format: {
  68.           suffix: "rpm",
  69.           defaultFormat: 0,
  70.           round: "1",
  71. //           ...formatterCustom,
  72.         },
  73.         style: { title: { "font-size": "10px" } },
  74.         type: "line",
  75.         orientation: "left",
  76.       },
  77.       {
  78.         title: "Oil Flow",
  79.         plot: [
  80.           {
  81.             value: "Coal Flow",
  82.             connectnulldata: false,
  83.             style: {
  84.               title: { "font-size": "10px" },
  85.             },
  86.           },
  87.           { value: "Oil Flow", connectnulldata: false },
  88.         ],
  89.         referenceLine: [],
  90.         format: {
  91.           suffix: "ton/h",
  92.           defaultFormat: 0,
  93.           round: "1",
  94. //           ...formatterCustom,
  95.         },
  96.         style: {
  97.           title: { "font-size": "10px" },
  98.         },
  99.         type: "line",
  100.         orientation: "right",
  101.       },
  102.       {
  103.         title: "Condenser Vacuum",
  104.         plot: [{ value: "Condenser Vacuum", connectnulldata: true }],
  105.         referenceLine: [],
  106.         format: {
  107.           suffix: "kPa",
  108.           defaultFormat: 0,
  109.           round: "1",
  110. //           ...formatterCustom,
  111.         },
  112.         style: { title: { "font-size": "10px" } },
  113.         type: "line",
  114.         orientation: "right",
  115.       },
  116.       {
  117.         title: "ST Metal Temperature",
  118.         plot: [
  119.           { value: "HP Turbine First Stage Temp.", connectnulldata: true },
  120.           { value: "Main Steam Temp.", connectnulldata: true },
  121.           { value: "Furnace Temperature", connectnulldata: true },
  122.           { value: "ST Metal Temperature", connectnulldata: true },
  123.           { value: "Main Steam Temp. (Ref) ", connectnulldata: true },
  124.         ],
  125.         referenceLine: [],
  126.         format: {
  127.           suffix: "°C",
  128.           defaultFormat: 0,
  129.           round: "1",
  130. //           ...formatterCustom,
  131.         },
  132.         style: { title: { "font-size": "10px" } },
  133.         type: "line",
  134.         orientation: "right",
  135.       },
  136.     ]
  137.  
  138.  var out = [];
  139.  
  140.     a.forEach(function(value){
  141.      
  142.       value.format =  {...formatterCustom, ...value.format}
  143.    
  144. //       console.log(value.format)
  145.       out.push(value)
  146.  
  147.     });
  148.  
  149. console.log(out);
  150.  
  151.  
  152.  
  153. // console.log(a);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement