# Chart graph comparison with SplitContainer

**URL:** <https://forum.inductiveautomation.com/t/chart-graph-comparison-with-splitcontainer/102789>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [February 24, 2025, 4:05pm UTC](https://forum.inductiveautomation.com/t/chart-graph-comparison-with-splitcontainer/102789 "2025-02-24T16:05:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [February 24, 2025, 4:05pm UTC](https://forum.inductiveautomation.com/t/chart-graph-comparison-with-splitcontainer/102789/1 "2025-02-24T16:05:32Z")

</div>

Hello team!

I have to compare 2 charts from 2 different years. I´m using a SplitContainer for this and is looking great...but...the only issue I´ve got is that the Y Axis value is not equivalent on the left and the right, so if you are not paying attention is hard to compare with non equivalent Y-axis. As you can see in this example, the mismatched Y-axis scales can be misleading.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/9/d9d608c33866c890ca3316b383f0a29bb4434075.png)

Any ideas of how to make both charts Y-axis equivalent for easy comparison?

Thanks

---

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [February 24, 2025, 4:50pm UTC](https://forum.inductiveautomation.com/t/chart-graph-comparison-with-splitcontainer/102789/2 "2025-02-24T16:50:02Z")

</div>

You could add a custom property to the view to bind the range if you're using the XY chart:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/1/e1870fcd4a2f3e067f677244282c00bfa406c6ad.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [February 24, 2025, 6:47pm UTC](https://forum.inductiveautomation.com/t/chart-graph-comparison-with-splitcontainer/102789/3 "2025-02-24T18:47:03Z")

</div>

If you can create custom properties, `chart1Max` and `chart2Max` holding the maximum value of each chart, then you can use an expression binding to find the higher value and another expression binding to create the yMax value.

_Expression binding for yAxisMax:_  
`max({this.custom.chart1Max}, {this.custom.chart2Max})`

Usually we want the yMax value to be a nice round number such as 1 × 10x, 2 × 10x, 5 × 10x, for example so that the grid labels will be nice round values.

_Expression transform:_

```python
// This function will return the next highest number 
// in the series 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, etc. 
// e.g. For value = 123, {value} / 10 ^ floor(log10({value}) returns 2,
// the number's power of ten = 2.
// {value} / 10 ^ floor(log10({value}) will return 1.23.
// https://forum.inductiveautomation.com/t/chart-graph-comparison-with-splitcontainer/102789/3

if({value} / 10 ^ floor(log10({value})) < 2,
	2 * 10 ^ floor(log10({value})),
	if({value} / 10 ^ floor(log10({value})) < 5,
		5 * 10 ^ floor(log10({value})),
		10 * 10 ^ floor(log10({value}))
	)
)

```

* * *

You could use a script transform instead. It's easier to read and understand but the expression will probably run faster.

> **Script transform version**
>
> ```python
> def transform(self, value, quality, timestamp):
> import math
> pow = math.floor(math.log10(value))
> num = value / 10 ** pow
> if num < 2:
> return 2 * 10 ** pow
> elif num < 5:
> return 5 * 10 ** pow
> else:
> return 10 * 10 ** pow	
> 
> ```

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [March 4, 2025, 3:37pm UTC](https://forum.inductiveautomation.com/t/chart-graph-comparison-with-splitcontainer/102789/4 "2025-03-04T15:37:45Z")

</div>

Yes, great! thanks Benjamin and Transistor. I just binded the max and min values

I just used the expression you wrote and its working enough well for me.

`max({this.custom.chart1Max}, {this.custom.chart2Max})`

for max values and

```python
min({this.custom.chart1Min}, {this.custom.chart2Min})

```

for min values,

I get the max value with a Script Transform for binded dataset:

```python
	
	if value and hasattr(value, 'getColumnNames'):
	    column_name = "AVG_KWIT" 
	
	
	    if column_name in value.getColumnNames():
	        # Extract values from the column
	        avg_kwit_values = [row[column_name] for row in system.dataset.toPyDataSet(value) if row[column_name] is not None]
	
	        # Find the maximum value, ensuring there are values to compare
	        max_value = max(avg_kwit_values) if avg_kwit_values else None
	    else:
	        max_value = None
	else:
	    max_value = None
	
	# Return the maximum value
	return max_value if max_value is not None else "No Data"

```

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/0/905b3f4ef8c6770c34a52d3620cdd508d13580f3.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/7/97061d1f6ebd5ab9bd39ac388eaec30aa00802e5.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/2/223139fe585a4848dadb0c14edfc522f114004ec.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/b/9bedb581a6df34c75b8398e3c812a0fb6038eea5.png)
