Ignition. Reporting. XY Chart. X-Axis auto scaling issue

Having issue with X-Axis in report design for XY Chart. When trend has less then 16 points of data it dividing the axis to the float numbers, I played a little with setting for x - axis, but it was not successfully. Can somebody give me a advice of how i can set or script the trend to show only values which is integer one, without float?

The simple formatting of values is not working it just duplicating values (see images in attachment)

I cannot place some default range (not auto scaling) because amount of data can start from 1 sample to a more then a 100.



Report trend x axis

I’ve spent a few minutes trying to recreate the problem only to realise that you’re working in Vision, not Perspective. Can you add the appropriate tag to your quesiton? Thanks.

I ran into the same issue today and came across this post looking for a solution. I didn't find one, so I am posting the solution I came up with.

  • Create a new report and configure a static CSV data source using the following data:

X,CT_minutes,Avg_minutes
1,282.77,390
2,198.47,390
3,184.95,390
4,226.2,390
5,154.65,390
6,148.13,390
7,195.25,390
8,1544.43,390

  • Drag an XY Chart into the Report Designer and configure the data from the report data source as follows:
    01_XYChartConfig

Note: The first pen uses the "Line" style and the second pen uses the "Bar" style with "Bar Labels" property set to True

  • Preview the report to show the issue is being reproduced:
    02_Preview1

  • To fix the X-Axis scaling, enable scripting on the XY Chart and disable the X-Axis Auto Range property as shown below:

  • Then, on the Chart Options tab, click the “Edit Script” button and enter the following script:

def configureChart(data, chart):
    from org.jfree.chart.axis import NumberTickUnit

    # get the dataset for the XY Chart and sort by column 0
    sortedData = system.dataset.sort(data['static_data'], 0)
    dsChart = system.dataset.toPyDataSet(sortedData)
    
    # get range for x-axis by taking value from first row and last row
    firstRow = dsChart[0]                
    lastRow = dsChart[len(dsChart)-1]
    minX = int(firstRow[0])                        # get min from first sorted row
    maxX = int(lastRow[0])                        # get max from last sorted row
    
    # add padding to X-Axis
    minX -= 1
    maxX += 1
    
    # set range on X-Axis and set the tick unit to 1
    domainAxis = chart.getPlot().getDomainAxis()
    domainAxis.setRange(minX, maxX)
    domainAxis.setTickUnit(NumberTickUnit(1.0))

  • Lastly, preview the report and see the issue is fixed.
    05_Preview2