Forum Discussion

NeilHEvotix's avatar
NeilHEvotix
Data Storage
11-02-2023

Line Polar Chart (Line) : Set 0 as Min value

For a Polar Chart of type "Line" the UI will not allow the value of 0 as the minimum (it resets it to the minimum value from the data provided).
The other polar types - column and area allow this.

Is there a way to change this via script?

3 Replies

Replies have been turned off for this discussion
  • Hi NeilHEvotix ,

    The script here will set the value in the design panel (widget.style.axis.min) to auto ('') and set the chart axis minimum to 0 before it is rendered. It also adds a dummy series to the chart with a value of '0' to force the minimum for the control to 0. It then disables the tool tip for this dummy series.

     

     

     

    widget.style.axis.min = ''
    
    widget.on('processresult', (w, args) => {
    	args.result.yAxis[0].min = 0
    	args.result.yAxis[0].autoMin = 0
    	args.result.series.push({
                "name": "dummy",
                "data": [
                    {
                        "y": 0
                    }
                ],
                "yAxis": 0
            })
    })
    
    widget.on('beforedatapointtooltip', (a, b) => {
      if (b.context.pointScope.series.name === 'dummy') {
        b.cancel = true
      }
    })
    

     

    Let me know if this workaround works for you?

    Thanks,

    Daniel

    [email protected]

    RAPID BI

    RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons

    • NeilHEvotix's avatar
      NeilHEvotix
      Data Storage

      Hi Daniel,

      Thank you for responding.

      I have tried the script, however when the chart is rendered it still has 2 at the centre.

      Neil