cornford-michael icon

Untitled

cornford-michael | PRO | 06/12/23 02:30:43 AM UTC | 0 ⭐ | 1642 👁️ | Never ⏰ | []
JavaScript |

3.69 KB

|

None

|

0 👍

/

0 👎

const formatterCustom = {
  formatter: (obj) => {
    return obj.value.toLocaleString("en-US", {
      minimumFractionDigits: 2,
      maximumFractionDigits: 4,
    });
  },
};
 
var a = [
      {
        title: "Main Steam Press.",
        plot: [
          {
            value: "Main Steam Press.",
            connectnulldata: true,
            style: {
              plot: {
                "stroke-dasharray": "5 2",
              },
            },
          },
        ],
        referenceLine: [],
        format: {
          suffix: "MPa",
          defaultFormat: 0,
          round: "1",
//           ...formatterCustom,
        },
        type: "line",
        orientation: "left",
      },
      {
        title: "Gross Output",
        plot: [{ value: "Gross Output", connectnulldata: true }],
        referenceLine: [],
        format: {
          suffix: "MW",
          defaultFormat: 0,
          round: "1",
//           ...formatterCustom,
        },
        style: {
          title: { "font-size": "10px" },
          "plot.null": {
            "stroke-dasharray": "5",
          },
        },
        type: "line",
        orientation: "left",
      },
      {
        title: "ST Speed",
        plot: [
          {
            value: "ST Speed",
            connectnulldata: true,
            style: {
              plot: {
                "stroke-dasharray": "5 2",
              },
            },
          },
        ],
        referenceLine: [],
        format: {
          suffix: "rpm",
          defaultFormat: 0,
          round: "1",
//           ...formatterCustom,
        },
        style: { title: { "font-size": "10px" } },
        type: "line",
        orientation: "left",
      },
      {
        title: "Oil Flow",
        plot: [
          {
            value: "Coal Flow",
            connectnulldata: false,
            style: {
              title: { "font-size": "10px" },
            },
          },
          { value: "Oil Flow", connectnulldata: false },
        ],
        referenceLine: [],
        format: {
          suffix: "ton/h",
          defaultFormat: 0,
          round: "1",
//           ...formatterCustom,
        },
        style: {
          title: { "font-size": "10px" },
        },
        type: "line",
        orientation: "right",
      },
      {
        title: "Condenser Vacuum",
        plot: [{ value: "Condenser Vacuum", connectnulldata: true }],
        referenceLine: [],
        format: {
          suffix: "kPa",
          defaultFormat: 0,
          round: "1",
//           ...formatterCustom,
        },
        style: { title: { "font-size": "10px" } },
        type: "line",
        orientation: "right",
      },
      {
        title: "ST Metal Temperature",
        plot: [
          { value: "HP Turbine First Stage Temp.", connectnulldata: true },
          { value: "Main Steam Temp.", connectnulldata: true },
          { value: "Furnace Temperature", connectnulldata: true },
          { value: "ST Metal Temperature", connectnulldata: true },
          { value: "Main Steam Temp. (Ref) ", connectnulldata: true },
        ],
        referenceLine: [],
        format: {
          suffix: "°C",
          defaultFormat: 0,
          round: "1",
//           ...formatterCustom,
        },
        style: { title: { "font-size": "10px" } },
        type: "line",
        orientation: "right",
      },
    ]
 
 var out = [];
 
    a.forEach(function(value){
      
      value.format =  {...formatterCustom, ...value.format}
    
//       console.log(value.format)
      out.push(value)
 
    });
 
console.log(out);
 
 
 
// console.log(a);

Comments