Charts using markLine/visualMap

I’m using following chart widget to plot Entso spot prices for electricity:

uid: Entso
tags: []
props:
  parameters:
    - context: item
      description: Main toggle item (use for single toggle or as main switch for group)
      label: Item
      name: item
      required: false
      type: TEXT
    - context: text
      default: You forgot to set a card title
      description: Pretty card label
      label: Title
      name: title
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Dec 25, 2023, 6:33:02 PM
component: f7-card
config:
  class:
    - padding-bottom
  title: =props.title
slots:
  default:
    - component: f7-row
      config:
        class:
          - margin-top
      slots:
        default:
          - component: f7-col
            config:
              width: 75
            slots:
              default:
                - component: oh-chart
                  config:
                    chartType: day
                    includeLabels: true
                    label: Kulutus
                  slots:
                    dataZoom:
                      - component: oh-chart-datazoom
                        config:
                          type: inside
                    grid:
                      - component: oh-chart-grid
                        config:
                          bottom: 60
                          containLabel: false
                          left: "40"
                          height: 50%
                          width: 75%
                    legend:
                      - component: oh-chart-legend
                        config:
                          bottom: 3
                          type: scroll
                    series:
                      - component: oh-aggregate-series
                        config:
                          aggregationFunction: last
                          dimension1: hour
                          gridIndex: 0
                          item: =props.item
                          
                          markLine:
                            data:
                              - itemStyle:
                                  color: red
                                yAxis: 1
                          markPoint:
                            data:
                              - itemStyle:
                                  color: green
                                name: min
                                type: min
                              - itemStyle:
                                  color: red
                                name: max
                                type: max
                              - precision: 1
                          name: SPOT tuntihinnat
                          offsetAmount: -1
                          offsetUnit: hour
                          service: influxdb
                          type: bar
                          xAxisIndex: 0
                          yAxisIndex: 0
                    tooltip:
                      - component: oh-chart-tooltip
                        config:
                          action: analyzer
                          actionAnalyzerChartType: day
                          actionAnalyzerItems:
                            - props.item
                          aggregationFunction: last
                          presetFeatures:
                            - dataZoom
                          right: right
                          show: true
                          top: top
                    xAxis:
                      - component: oh-category-axis
                        config:
                          categoryType: day
                          gridIndex: 0
                          monthFormat: default
                          name: Aika (h)
                          nameGap: 25
                          nameLocation: center
                          weekdayFormat: default
                    yAxis:
                      - component: oh-value-axis
                        config:
                          gridIndex: 0
                          name: Hinta (snt/kWh)
                          nameGap: 25
                          nameLocation: center

The widget produces a plot shown below:
Screenshot 2023-12-25 185522

The example shows a markLine (red horizontal line) with yAxis: 1. I would like to plot this horizontal markLine with Y value of my Item “Ouflex_AXL_Reg395”. Any ideas how to do this?

I have tried to use different syntaxes for yAxis:

markLine:
                            data:
                              - lineStyle:
                                  color: red
                                  type: solid
                                yAxis: "=props.Ouflex_AXL_Reg395 ? true : false"

This will procude a plot shown below:

Markline has a value of 0.

I would like to get the widget working, i.e. a markline showing the value of Item Ouflex_AXL_Reg395. I’m controlling my Nibe ground source heat pump with Ouman Ouflex controller using the aux-inputs on the heat pump. Ouman can calculate the cheapest hours for electricity and it allows Nibe to run only during these cheap hours. The horizontal markline would show the price limit and when the hourly price is below this limit then Nibe would run.

Any ideas what is the correct syntax for yAxis?

I have now tried to use visualMap but it doesn’t work either:

 visualMap:
                      - component: oh-chart-visualmap
                        config:
                          pieces:
                            - min: 0
                              max: '=props.Ouflex_AXL_Reg395'
                              color: green
                            - min: '=props.Ouflex_AXL_Reg395'
                              max: 100
                              color: red
                              
                          type: piecewise
                          seriesIndex: 0

This produces following graph:

Screenshot 2023-12-29 192146

It is quite obvious that the number value of Item Ouflex_AXL_Reg395 is not parsed correctly. Any ideas?

I have found a solution to the markLine problem which is based on the discussion in this topichttps://community.openhab.org/t/knob-gets-red-but-should-be-green/152729/6. The code snippet for the markLine is:

markLine:
     data:
         - lineStyle:
             color: red
             type: solid
             yAxis:  =Number.parseFloat(items.Ouflex_AXL_Reg395.state)