Suggestion required on X axis date position changes


in this chart i need to adjust the Position of time in xaxis equal to chart bullet position. Kindly refer the code and give suggestions



{
  "example": {
    "$": [
      "ds",
      192,
      1695964010030
    ],
    "$columns": [
      {
        "name": "time",
        "type": "Date",
        "data": [
          1695947401710,
          1695951001343,
          1695954601610,
          1695958201833,
          1695961801417
        ]
      },
      {
        "name": "kwh",
        "type": "String",
        "data": [
          "4.83386e+007",
          "4.83397e+007",
          "4.83409e+007",
          "4.83422e+007",
          "4.83432e+007"
        ]
      },
      {
        "name": "KWH1",
        "type": "Double",
        "data": [
          null,
          1100.0,
          1200.0,
          1300.0,
          1000.0
        ]
      }
    ]
  }
}
[
  {
    "name": "time",
    "label": {
      "enabled": false,
      "text": "Time",
      "color": "#2B2B2B"
    },
    "inversed": false,
    "visible": true,
    "tooltip": {
      "enabled": true,
      "text": "",
      "cornerRadius": 3,
      "pointerLength": 4,
      "background": {
        "color": "",
        "opacity": 1
      }
    },
    "render": "date",
    "category": {
      "break": {
        "enabled": false,
        "startCategory": "",
        "endCategory": "",
        "size": 0.05
      }
    },
    "date": {
      "baseInterval": {
        "enabled": true,
        "timeUnit": "hour",
        "count": 1,
        "skipEmptyPeriods": false
      },
      "range": {
        "max": "",
        "min": "",
        "useStrict": false
      },
      "break": {
        "enabled": false,
        "startDate": "",
        "endDate": "",
        "size": 0.05
      },
      "inputFormat": "HH:mm:ss",
      "format": "HH:mm"
    },
    "value": {
      "range": {
        "max": "",
        "min": "",
        "useStrict": false
      },
      "logarithmic": false,
      "break": {
        "enabled": false,
        "startValue": 0,
        "endValue": 100,
        "size": 0.05
      },
      "format": "#,###.##"
    },
    "appearance": {
      "opposite": false,
      "inside": false,
      "labels": {
        "color": "#000000",
        "opacity": 2,
        "rotation": 65,
        "position": 2
      },
      "grid": {
        "color": "#2B2B2B",
        "opacity": 0.5,
        "dashArray": "",
        "minDistance": 50,
        "position": 0.2
      },
      "font": {
        "size": 18,
        "weight": 1000
      }
    }
  }
]
type or paste code here

That looks like an XY Chart component. You should state that in your question title.

Can you post the whole XY Chart JSON here? Right-click it in Project Browser, copy and paste.


Tip:
Area charts represent an integral of the Y-axis variable with respect to the X-axis. If you plotted speed (km/h) against time (h) then the area would represent the distance covered (km/h × h = km).
If you were to plot power (kW) versus time (h) then the area would represent energy (kW × h = kWh).

Your area chart is showing the integral of energy (kWh) versus time (h) giving you kWh × h = kWh2 which is not what you want to convey. You should be just using a line.

I have Binded the whole chart Property configuration kindly give suggestions to locate the correct value with respect to Xaxis time


I need all the time to plot in the Xaxis kindly give suggestions.

  1. XY Chart Configurations
[
  {
    "type": "ia.chart.xy",
    "version": 0,
    "props": {
      "title": {
        "text": "Hourwise Energy (kWh)",
        "appearance": {
          "color": "#000000",
          "font": {
            "size": 20,
            "weight": 1000
          },
          "padding": {
            "bottom": 5,
            "left": 15,
            "right": 10
          }
        }
      },
      "legend": {
        "enabled": false,
        "markers": {
          "width": 10,
          "height": 3,
          "stroke": {
            "color": "#000000"
          }
        },
        "labels": {
          "font": {
            "weight": 1000,
            "size": 15,
            "color": "#000000"
          }
        }
      },
      "cursor": {
        "series": "example",
        "lineX": {
          "stroke": {
            "color": "#2B2B2B",
            "width": 0.5
          }
        },
        "lineY": {
          "stroke": {
            "color": "#2B2B2B",
            "width": 0.5
          }
        }
      },
      "enableTransitions": true,
      "xAxes": [
        {
          "name": "time",
          "label": {
            "enabled": false,
            "text": "Time",
            "color": "#2B2B2B"
          },
          "visible": true,
          "tooltip": {
            "enabled": true,
            "text": "",
            "cornerRadius": 3,
            "pointerLength": 4,
            "background": {
              "color": "",
              "opacity": 1
            }
          },
          "inversed": false,
          "render": "date",
          "category": {
            "break": {
              "enabled": false,
              "startCategory": "",
              "endCategory": "",
              "size": 0.05
            }
          },
          "date": {
            "baseInterval": {
              "enabled": true,
              "timeUnit": "hour",
              "count": 1,
              "skipEmptyPeriods": false
            },
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            },
            "break": {
              "enabled": false,
              "startDate": "",
              "endDate": "",
              "size": 0.05
            },
            "inputFormat": "HH:mm:ss",
            "format": "hh:mma"
          },
          "value": {
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            },
            "logarithmic": false,
            "break": {
              "enabled": false,
              "startValue": 0,
              "endValue": 100,
              "size": 0.05
            },
            "format": "#,###.##"
          },
          "appearance": {
            "opposite": false,
            "inside": false,
            "labels": {
              "color": "#000000",
              "opacity": 2,
              "position": 90,
              "rotation": 45
            },
            "grid": {
              "color": "#2B2B2B",
              "opacity": 0.5,
              "dashArray": "",
              "minDistance": 90,
              "position": 0.5
            },
            "font": {
              "size": 18,
              "weight": 1000
            }
          }
        }
      ],
      "yAxes": [
        {
          "name": "KWH1",
          "label": {
            "enabled": true,
            "text": "kWh",
            "color": "#000000"
          },
          "visible": true,
          "tooltip": {
            "enabled": true,
            "text": "",
            "cornerRadius": 3,
            "pointerLength": 4,
            "background": {
              "color": "",
              "opacity": 1
            }
          },
          "inversed": false,
          "render": "value",
          "category": {
            "break": {
              "enabled": false,
              "startCategory": "",
              "endCategory": "",
              "size": 0.05
            }
          },
          "date": {
            "baseInterval": {
              "enabled": false,
              "timeUnit": "hour",
              "count": 1,
              "skipEmptyPeriods": true
            },
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            },
            "break": {
              "enabled": false,
              "startDate": "",
              "endDate": "",
              "size": 0.05
            },
            "inputFormat": "yyyy-MM-dd kk:mm:ss",
            "format": "M/d/yyyy HH:mm:ss"
          },
          "value": {
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            },
            "logarithmic": false,
            "break": {
              "enabled": false,
              "startValue": 0,
              "endValue": 100,
              "size": 0.05
            },
            "format": "#,###.##"
          },
          "appearance": {
            "opposite": false,
            "inside": false,
            "labels": {
              "color": "#2B2B2B",
              "opacity": 1
            },
            "grid": {
              "color": "",
              "opacity": 0.5,
              "dashArray": "",
              "minDistance": null,
              "position": 0.2
            },
            "font": {
              "size": 18,
              "weight": 1000
            }
          }
        }
      ],
      "series": [
        {
          "name": "KWH1",
          "label": {
            "text": "Energy"
          },
          "visible": true,
          "hiddenInLegend": false,
          "defaultState": {
            "visible": true
          },
          "data": {
            "source": "example",
            "x": "time",
            "y": "KWH1"
          },
          "xAxis": "time",
          "yAxis": "KWH1",
          "zIndex": 0,
          "tooltip": {
            "enabled": true,
            "text": "{name}: [bold]{valueY}[/]\nDate:[bold]{dateX}[/]",
            "cornerRadius": 1,
            "pointerLength": 1,
            "background": {
              "color": "#2B2B2B",
              "opacity": 1
            }
          },
          "render": "line",
          "candlestick": {
            "open": {
              "x": "",
              "y": ""
            },
            "high": {
              "x": "",
              "y": ""
            },
            "low": {
              "x": "",
              "y": ""
            },
            "appearance": {
              "fill": {
                "color": "",
                "opacity": 1
              },
              "stroke": {
                "color": "",
                "opacity": 1,
                "width": 1
              },
              "stacked": false,
              "deriveFieldsFromData": {
                "fill": {
                  "color": "",
                  "opacity": ""
                },
                "stroke": {
                  "color": "",
                  "opacity": "",
                  "width": ""
                }
              },
              "heatRules": {
                "enabled": false,
                "max": "",
                "min": "",
                "dataField": ""
              }
            }
          },
          "column": {
            "open": {
              "x": "",
              "y": ""
            },
            "appearance": {
              "fill": {
                "color": "",
                "opacity": 1
              },
              "stroke": {
                "color": "",
                "opacity": 1,
                "width": 1
              },
              "stacked": false,
              "width": null,
              "height": null,
              "deriveFieldsFromData": {
                "fill": {
                  "color": "",
                  "opacity": ""
                },
                "stroke": {
                  "color": "",
                  "opacity": "",
                  "width": ""
                }
              },
              "heatRules": {
                "enabled": false,
                "max": "",
                "min": "",
                "dataField": ""
              }
            }
          },
          "line": {
            "open": {
              "x": 0,
              "y": 0
            },
            "appearance": {
              "connect": true,
              "tensionX": 1,
              "tensionY": 1,
              "minDistance": 0.5,
              "stroke": {
                "width": 2,
                "opacity": 2,
                "color": "#2B2B2B",
                "dashArray": ""
              },
              "fill": {
                "opacity": 0.5,
                "color": "#CCCCFF"
              },
              "bullets": [
                {
                  "enabled": true,
                  "render": "circle",
                  "width": 2,
                  "height": 2,
                  "label": {
                    "text": "{value}",
                    "position": {
                      "dx": 0,
                      "dy": 0
                    }
                  },
                  "fill": {
                    "color": "#8A8AFF",
                    "opacity": 2
                  },
                  "stroke": {
                    "color": "#000000",
                    "opacity": 1,
                    "width": 1
                  },
                  "rotation": 0,
                  "tooltip": {
                    "enabled": true,
                    "text": "{name}: [bold]{valueY}[/]\nDate:[bold]{dateX}[/]\nTime:[bold]{dateX.formatDate('HH:mm:ss')}[/]",
                    "cornerRadius": 3,
                    "pointerLength": 3,
                    "background": {
                      "color": "#8A8AFF",
                      "opacity": 1
                    }
                  },
                  "deriveFieldsFromData": {
                    "fill": {
                      "color": "",
                      "opacity": ""
                    },
                    "stroke": {
                      "color": "",
                      "opacity": "",
                      "width": ""
                    },
                    "rotation": ""
                  },
                  "heatRules": {
                    "enabled": false,
                    "max": 100,
                    "min": 2,
                    "dataField": ""
                  }
                }
              ]
            }
          },
          "stepLine": {
            "open": {
              "x": "",
              "y": ""
            },
            "appearance": {
              "connect": true,
              "tensionX": 1,
              "tensionY": 1,
              "minDistance": 0.5,
              "stroke": {
                "width": 3,
                "opacity": 1,
                "color": "",
                "dashArray": ""
              },
              "fill": {
                "opacity": 0,
                "color": ""
              },
              "bullets": [
                {
                  "enabled": true,
                  "render": "circle",
                  "width": 10,
                  "height": 10,
                  "label": {
                    "text": "{value}",
                    "position": {
                      "dx": 0,
                      "dy": 0
                    }
                  },
                  "fill": {
                    "color": "",
                    "opacity": 1
                  },
                  "stroke": {
                    "color": "",
                    "opacity": 1,
                    "width": 1
                  },
                  "rotation": 0,
                  "tooltip": {
                    "enabled": true,
                    "text": "{name}: [bold]{valueY}[/]",
                    "cornerRadius": 3,
                    "pointerLength": 4,
                    "background": {
                      "color": "",
                      "opacity": 1
                    }
                  },
                  "deriveFieldsFromData": {
                    "fill": {
                      "color": "",
                      "opacity": ""
                    },
                    "stroke": {
                      "color": "",
                      "opacity": "",
                      "width": ""
                    },
                    "rotation": ""
                  },
                  "heatRules": {
                    "enabled": false,
                    "max": 100,
                    "min": 2,
                    "dataField": ""
                  }
                }
              ]
            }
          }
        }
      ],
      "style": {
        "backgroundColor": "#D5D5D5",
        "color": "#000000",
        "fontSize": 20,
        "fontWeight": "bold"
      },
      "dataSources": {}
    },
    "meta": {
      "name": "XYChart"
    },
    "position": {
      "x": 13.907540000000001,
      "y": 12.911142089843793,
      "height": 316,
      "width": 802
    },
    "custom": {},
    "propConfig": {
      "props.dataSources.example": {
        "binding": {
          "config": {
            "parameters": {
              "bg": "{.../BG_Dropdown.props.value}",
              "ll": "{.../Line_Dropdown.props.value}",
              "ma": "{.../Machine_Dropdown.props.value}",
              "pl": "{.../Plant_Dropdown.props.value}",
              "sp": "dateArithmetic({.../DateTimeInput.props.value}, 25, \"hours\")",
              "st": "dateArithmetic({.../DateTimeInput.props.value},0,\"hours\")"
            },
            "polling": {
              "enabled": true,
              "rate": "300"
            },
            "queryPath": "HalfNHour",
            "returnFormat": "dataset"
          },
          "type": "query"
        }
      }
    }
  }
]

2.Dataset configurations

{
  "example": {
    "$": [
      "ds",
      192,
      1698214706770
    ],
    "$columns": [
      {
        "name": "time",
        "type": "Date",
        "data": [
          1698193801343,
          1698197401487,
          1698201001357,
          1698204601123,
          1698208201007,
          1698211801317
        ]
      },
      {
        "name": "kwh",
        "type": "String",
        "data": [
          "4.89372e+007",
          "4.89382e+007",
          "4.89391e+007",
          "4.89398e+007",
          "4.89403e+007",
          "4.89408e+007"
        ]
      },
      {
        "name": "KWH1",
        "type": "Double",
        "data": [
          null,
          1000.0,
          900.0,
          700.0,
          500.0,
          500.0
        ]
      }
    ]
  }
}

Can u give any suggestions or some other threads to check this?

Please post the dataset as well. You've posted the query binding but since we don't have the database or the query our chart is blank.

Dataset json :


{
  "$": [
    "ds",
    192,
    1698653865302
  ],
  "$columns": [
    {
      "name": "time",
      "type": "Date",
      "data": [
        1698625801203,
        1698629400073,
        1698633000550,
        1698636601580,
        1698640201283,
        1698643801913,
        1698647401947,
        1698651001677
      ]
    },
    {
      "name": "kwh",
      "type": "String",
      "data": [
        "4.9061e+007",
        "4.90623e+007",
        "4.90633e+007",
        "4.90643e+007",
        "4.90651e+007",
        "4.90657e+007",
        "4.90663e+007",
        "4.90668e+007"
      ]
    },
    {
      "name": "KWH1",
      "type": "Double",
      "data": [
        null,
        1300.0,
        1000.0,
        1000.0,
        800.0,
        600.0,
        600.0,
        500.0
      ]
    }
  ]
}

Named Query
select cast(Date as datetime) as time,(KWH) as kwh , convert(float,KWH)-LAG(convert(float,KWH)) OVER(order by Date) as KWH1 FROM Main
WHERE BG =:bg and Plant =:pl and Line =:ll and Machine =:ma and Date between :st AND :sp and (datepart(minute,Date) % 60) = 0 and KWH !='0'
ORDER BY Date asc
Here is the named query and dataset for your reference

Try this:
xAxes.0.appearance.grid.minDistance : 1
xAxes.0.appearance.grid.position : 0

I think your fime format is a bit mixed up. Either use 24-hour format with leading zero, "04:00" or AM/PM format without leading zero, "4:00 am". See this style guide on the subject of whether or not to use capital letters and the use of a space between the numbers and am/pm. Unfortunately the AM Charts (on which the component is based) formatting defaults to AM/PM. There is a fix in Make AM/PM prompts lowercase or change them but I haven't figured out how to incorporate that into Ignition.