# Chart with one two-color line (battery charging)

**URL:** <https://discourse.nodered.org/t/chart-with-one-two-color-line-battery-charging/30783>\
**Category:** Dashboard\
**Created:** [27 July 2020 18:48 UTC](https://discourse.nodered.org/t/chart-with-one-two-color-line-battery-charging/30783 "2020-07-27T18:48:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefan24](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stefan24/32/23075_2.png) [@stefan24](https://discourse.nodered.org/u/stefan24)\
**Post date:** [27 July 2020 18:48 UTC](https://discourse.nodered.org/t/chart-with-one-two-color-line-battery-charging/30783/1 "2020-07-27T18:48:24Z")

</div>

Hi!

I want to display a chart which shows the (dis-)charging of the battery of my (Linux) notebook as xx% full.

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d43cbd2f15bf403f7c0bb17274ac56b0038eab71.png)

I'm filling the chart with a function node.

BTW: I get the result from a exec node, which calls `acpi -bi | head -1`.

But I want the line while discharging in orange and the (same?) line while charging in green.

So I'm just changing the topic

```auto
if (battery.payload)
{werte.topic = "discharge"}
else
{werte.topic = "charge"}

```

But the second line always make a straight line to the point, where I change the charge state.  
How do I generate a single line with different colors for charging and discharging?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [27 July 2020 19:26 UTC](https://discourse.nodered.org/t/chart-with-one-two-color-line-battery-charging/30783/2 "2020-07-27T19:26:59Z")

</div>

Simple answer is you can’t. But you are almost there. If you send a null to each topic it will force a break in the line so you can avoid the line filling in.

---

<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:** [26 August 2020 19:27 UTC](https://discourse.nodered.org/t/chart-with-one-two-color-line-battery-charging/30783/3 "2020-08-26T19:27:03Z")

</div>

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