# Modifying the y.axis of a graph

**URL:** <https://discourse.nodered.org/t/modifying-the-y-axis-of-a-graph/58841>\
**Category:** Dashboard\
**Created:** [22 February 2022 20:25 UTC](https://discourse.nodered.org/t/modifying-the-y-axis-of-a-graph/58841 "2022-02-22T20:25:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Disaile12](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@Disaile12](https://discourse.nodered.org/u/Disaile12)\
**Post date:** [22 February 2022 20:25 UTC](https://discourse.nodered.org/t/modifying-the-y-axis-of-a-graph/58841/1 "2022-02-22T20:25:43Z")

</div>

Hello, a query, it is possible to eliminate these points from the y-axis of a graph. I would like to be able to do that since I only want to graph two boolean states 0 or 1.  
I'd appreciate your help.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/3957d74c8f3722fd32b1bd46c03767a77d5f90ee.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/1/a151b3422d2124c597971c5f2433318bfe81f043.png)

This is my function node:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/b/abbab96dfc7630cb945d0a7260eac386ca1571ad.png)

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [22 February 2022 21:37 UTC](https://discourse.nodered.org/t/modifying-the-y-axis-of-a-graph/58841/2 "2022-02-22T21:37:36Z")

</div>

It is possible.  
But it does override all about the scales configuration. Ticks, grid, colors .... All that needs to be also configured.

> **[Axes | Chart.js](https://www.chartjs.org/docs/latest/axes/)**
>
> Open source HTML5 Charts for your website

```auto
[
    {
        "id": "ce96a4b5901ad0ef",
        "type": "ui_chart",
        "z": "2e6686c4918f199d",
        "name": "",
        "group": "c7a27394.057878",
        "order": 15,
        "width": 0,
        "height": 0,
        "label": "chart",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "step",
        "nodata": "",
        "dot": false,
        "ymin": "",
        "ymax": "",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "60",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 710,
        "y": 310,
        "wires": [
            []
        ]
    },
    {
        "id": "e283fc5fde025a95",
        "type": "random",
        "z": "2e6686c4918f199d",
        "name": "",
        "low": "0",
        "high": "1",
        "inte": "true",
        "property": "payload",
        "x": 470,
        "y": 300,
        "wires": [
            [
                "ce96a4b5901ad0ef"
            ]
        ]
    },
    {
        "id": "3ba79bebb39971a4",
        "type": "inject",
        "z": "2e6686c4918f199d",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "2",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 130,
        "y": 300,
        "wires": [
            [
                "e283fc5fde025a95"
            ]
        ]
    },
    {
        "id": "f5e78a2878ead886",
        "type": "change",
        "z": "2e6686c4918f199d",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "ui_control",
                "pt": "msg",
                "to": "{\"options\":{\"scales\":{\"yAxes\":[{\"ticks\":{\"max\":1,\"min\":0,\"stepSize\":1}}],\"xAxes\":[{\"type\":\"time\"}]}}}",
                "tot": "json"
            },
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 450,
        "y": 340,
        "wires": [
            [
                "ce96a4b5901ad0ef"
            ]
        ]
    },
    {
        "id": "de716142b9180916",
        "type": "inject",
        "z": "2e6686c4918f199d",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 340,
        "wires": [
            [
                "f5e78a2878ead886"
            ]
        ]
    },
    {
        "id": "c7a27394.057878",
        "type": "ui_group",
        "name": "CHART",
        "tab": "54e197d8.7f7fe8",
        "order": 2,
        "disp": false,
        "width": "9",
        "collapse": false
    },
    {
        "id": "54e197d8.7f7fe8",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![Disaile12](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@Disaile12](https://discourse.nodered.org/u/Disaile12)\
**Post date:** [23 February 2022 18:34 UTC](https://discourse.nodered.org/t/modifying-the-y-axis-of-a-graph/58841/3 "2022-02-23T18:34:51Z")

</div>

Hello, thanks for your help, I already applied it and it works fine.  
A query if I want the maximum and minimum values ​​and the time of the axes to take a white color, what instruction should I use?

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [24 February 2022 06:57 UTC](https://discourse.nodered.org/t/modifying-the-y-axis-of-a-graph/58841/4 "2022-02-24T06:57:33Z")

</div>

Explore the examples from this topic.

> [@Dashboard tips. ui\_chart with linear x-axis](https://discourse.nodered.org/t/dashboard-tips-ui-chart-with-linear-x-axis/40310):
>
> A little example about ui\_chart advanced configuration. Catch the Boson stuck_out_tongueboom [{"id":"1076704a.386908","type":"ui\_button","z":"7ee51301.a9185c","name":"","group":"c7a27394.057878","order":1,"width":1,"height":1,"passthru":false,"label":"GO","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"reset","x":190,"y":360,"wires":[["1c612e7d.432ac2"]]},{"id":"f84ec1a3.50318","type":"ui\_chart","z":"7ee51301.a9185c","name":"","group":…

---

<div class="post-metadata">

**Author:** ![Disaile12](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@Disaile12](https://discourse.nodered.org/u/Disaile12)\
**Post date:** [24 February 2022 13:44 UTC](https://discourse.nodered.org/t/modifying-the-y-axis-of-a-graph/58841/5 "2022-02-24T13:44:33Z")

</div>

Thank you very much, in another post I saw that you helped someone to dynamically modify the x-axis of a graph, that also helped me.

Greetings.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 March 2022 13:44 UTC](https://discourse.nodered.org/t/modifying-the-y-axis-of-a-graph/58841/6 "2022-03-10T13:44:52Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
