Perspective TimeSeries Chart axis scaling

Hi Everyone.
I have a question.
When I am trying to put min/max to axis like -150/150, so the axis looks like -200/200
When I put -140/140, so the axis looks that way what I need it looks like - -140/140
So… what’s wrong with -150/150 limits?
Thanx in Advance :slight_smile:

GOOD (-140/140):

NOT GOOD (-150-150):

What are those custom props bound to on the chart?

Hi. Thanx for replay
I have 3 axes
To all of these axes I bound these limits

what’s your plots[x].axes[y].tick.count set to? this will determine the values you see. It seems like if this is set to Auto, that’s when the max can go above the max you set. If you set a fixed tick count, then it honours it

But if i put not Auto, so I get ugly numbers

you can set the format under label e.g. to integer (d)

For another Object I get these:

image

It does not look pretty

That’s because the tick count you set isn’t divisible by your range. If it’s dynamic, then you need to bind the tick count and calculate the number of ticks so that it gives round tick numbers.

E.g. if you have -150 to 150 and want it to increment by 50, 150- -150 = 300, 300/50 = 6. You have to add 1 to get 7 ticks.

It’s not as nice as just setting it to Auto…

1 Like

Thanx! I will do as You recommended.
It’s the best solution to get what Client wants!
:smiling_face_with_three_hearts:

This seems to work ok for a number of ranges. Copy the JSON below and paste it into a View and have a look at the custom props and the bindings on the axes

[
  {
    "type": "ia.chart.timeseries",
    "version": 0,
    "props": {
      "series": [
        {
          "name": "Boiler",
          "data": [
            {
              "time": 1560469431423,
              "Temperature": 52,
              "Pressure": 12
            },
            {
              "time": 1560469432423,
              "Temperature": 18,
              "Pressure": 42
            },
            {
              "time": 1560469433423,
              "Temperature": 26,
              "Pressure": 81
            },
            {
              "time": 1560469434423,
              "Temperature": 63,
              "Pressure": 11
            },
            {
              "time": 1560469435423,
              "Temperature": 65,
              "Pressure": 23
            },
            {
              "time": 1560469436423,
              "Temperature": 12,
              "Pressure": 43
            },
            {
              "time": 1560469437423,
              "Temperature": 61,
              "Pressure": 71
            },
            {
              "time": 1560469438423,
              "Temperature": 60,
              "Pressure": 89
            },
            {
              "time": 1560469439423,
              "Temperature": 58,
              "Pressure": 66
            },
            {
              "time": 1560469440423,
              "Temperature": 1,
              "Pressure": 33
            }
          ]
        }
      ],
      "plots": [
        {
          "relativeWeight": 1,
          "trends": [
            {
              "visible": true,
              "type": "line",
              "series": "Boiler",
              "interpolation": "curveLinear",
              "breakLine": true,
              "stack": true,
              "radius": 2,
              "axis": "default",
              "columns": [],
              "baselines": []
            }
          ],
          "axes": [
            {
              "name": "default",
              "alignment": "left",
              "width": 60,
              "label": {
                "visible": true,
                "text": "",
                "offset": 0,
                "font": {
                  "color": "",
                  "size": 10
                },
                "style": {
                  "classes": ""
                }
              },
              "tick": {
                "color": "",
                "label": {
                  "format": "d",
                  "font": {
                    "color": "",
                    "size": 10
                  },
                  "style": {
                    "classes": ""
                  }
                },
                "style": {
                  "classes": ""
                }
              },
              "grid": {
                "visible": true,
                "color": "#2b2b2b",
                "opacity": 0.1,
                "dashArray": 0,
                "style": {
                  "classes": ""
                }
              },
              "style": {
                "classes": ""
              }
            }
          ],
          "markers": []
        }
      ]
    },
    "meta": {
      "name": "TimeSeriesChart"
    },
    "position": {
      "basis": "400px"
    },
    "custom": {
      "min": -2000,
      "max": 2000,
      "calc": {}
    },
    "propConfig": {
      "props.plots[0].axes[0].tick.count": {
        "binding": {
          "type": "expr",
          "config": {
            "expression": "{this.custom.calc.tickCount}"
          }
        }
      },
      "custom.range": {
        "binding": {
          "type": "expr",
          "config": {
            "expression": "{this.custom.max} - {this.custom.min}"
          }
        }
      },
      "props.plots[0].axes[0].min": {
        "binding": {
          "type": "property",
          "config": {
            "path": "this.custom.min"
          }
        }
      },
      "props.plots[0].axes[0].max": {
        "binding": {
          "type": "property",
          "config": {
            "path": "this.custom.max"
          }
        }
      },
      "custom.calc.roughInterval": {
        "binding": {
          "type": "expr",
          "config": {
            "expression": "{this.custom.range} / 7"
          }
        }
      },
      "custom.calc.magnitude": {
        "binding": {
          "type": "expr",
          "config": {
            "expression": "pow(10, floor(log10({this.custom.calc.roughInterval})))"
          }
        }
      },
      "custom.calc.normalised": {
        "binding": {
          "type": "expr",
          "config": {
            "expression": "{this.custom.calc.roughInterval} / {this.custom.calc.magnitude}"
          }
        }
      },
      "custom.calc.niceFactor": {
        "binding": {
          "type": "expr",
          "config": {
            "expression": "if({this.custom.calc.normalised} <= 1.5, 1,\r\nif({this.custom.calc.normalised} <= 3.0, 2,\r\nif({this.custom.calc.normalised} <= 7.0, 5,\r\n10)))"
          }
        }
      },
      "custom.calc.tickCount": {
        "binding": {
          "type": "expr",
          "config": {
            "expression": "floor({this.custom.range} / ({this.custom.calc.niceFactor} * {this.custom.calc.magnitude})) + 1"
          }
        }
      }
    }
  }
]

Claude helped a bit - see the original below

It could do with some tweaking for some ranges like 150, 75

1 Like