Forum Discussion

jfarmer's avatar
jfarmer
Cloud Apps
10-18-2022
Solved

Change Axis labels on Line Chart

I have a couple dashboards with month numbers instead of month names as the x-axis labels, and I modify the numbers to month names with the following script. It works when I am editing the widget, bu...
  • Harry's avatar
    10-18-2022

    Hello jfarmer ,

    I think this is because the script you added in 'domready' event. Hope below script works here.

     

    newItemMapping = { '1':'Jan',
    				  '2':'Feb',
    				  '3':'Mar',
    				  '4':'Apr',
    				  '5':'May'
    				}
    
    widget.on("queryend", function(se, ev){
    	
    	var panelName = 'Day Number' //Items in this panel will be replaced with new items
    	
    	panelIndex = ev.rawResult.headers.indexOf(panelName)
    	$.each(ev.rawResult.values, function(index, value){
    
    		
    		if(newItemMapping[value[panelIndex].text] != undefined)
    		{
    			value[panelIndex].data = newItemMapping[value[panelIndex].data]
    			value[panelIndex].text = newItemMapping[value[panelIndex].text]
    		}
    	})	
    })

    Always here to help,
    Harry from QBeeQ
    [email protected]
    www.qbeeq.pl