# Chart Line Colors

**URL:** <https://community.openhab.org/t/chart-line-colors/4479>\
**Category:** Beginners\
**Created:** [November 24, 2015, 4:22pm UTC](https://community.openhab.org/t/chart-line-colors/4479 "2015-11-24T16:22:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yancym](https://community.openhab.org/letter_avatar_proxy/v4/letter/y/ad7895/32.png) [@yancym](https://community.openhab.org/u/yancym)\
**Post date:** [November 24, 2015, 4:22pm UTC](https://community.openhab.org/t/chart-line-colors/4479/1 "2015-11-24T16:22:24Z")

</div>

I’m looking for a way to control the color of the lines on my charts. Is there any way to do that?

Thanks

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [November 24, 2015, 7:35pm UTC](https://community.openhab.org/t/chart-line-colors/4479/2 "2015-11-24T19:35:12Z")

</div>

Nope. You are stuck with the colors it give you. Habmin provides more options for charting.

---

<div class="post-metadata">

**Author:** ![poertner](https://community.openhab.org/user_avatar/community.openhab.org/poertner/32/160_2.png) [@poertner](https://community.openhab.org/u/poertner)\
**Post date:** [April 1, 2016, 11:32pm UTC](https://community.openhab.org/t/chart-line-colors/4479/3 "2016-04-01T23:32:48Z")

</div>

hi!

i just inserted a default chart into my dashing web-frontend.  
my frontend’s theme is mainly dark, the grey charts don’t really look good now.  
i know it’s not possible to add color-attributes when requesting a chart.

but… 😉  
would it be possible to change the default colors by manipulating the “chart generating” file?  
is that possible? where would i find that file, or is it compiled somewhere and can’t be accessed?

thx,  
stefan

```
/*
 * Copyright (c) 2010-2014, openHAB.org and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.openhab.ui.internal.chart;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.openhab.core.items.GroupItem;
import org.openhab.core.items.Item;
import org.openhab.core.items.ItemNotFoundException;
import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.OpenClosedType;
import org.openhab.core.persistence.FilterCriteria;
import org.openhab.core.persistence.FilterCriteria.Ordering;
import org.openhab.core.persistence.HistoricItem;
import org.openhab.core.persistence.PersistenceService;
import org.openhab.core.persistence.QueryablePersistenceService;
import org.openhab.ui.chart.ChartProvider;
import org.openhab.ui.items.ItemUIRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.awt.BasicStroke;

import com.xeiam.xchart.Chart;
import com.xeiam.xchart.ChartBuilder;
import com.xeiam.xchart.Series;
import com.xeiam.xchart.SeriesMarker;
import com.xeiam.xchart.StyleManager.LegendPosition;

/**
 * This servlet generates time-series charts for a given set of items. It
 * accepts the following HTTP parameters:
 * <ul>
 * <li>w: width in pixels of image to generate</li>
 * <li>h: height in pixels of image to generate</li>
 * <li>period: the time span for the x-axis. Value can be
 * h,4h,8h,12h,D,3D,W,2W,M,2M,4M,Y</li>
 * <li>items: A comma separated list of item names to display</li>
 * <li>groups: A comma separated list of group names, whose members should be
 * displayed</li>
 * <li>service: The persistence service name. If not supplied the first service
 * found will be used.</li>
 * </ul>
 * 
 * @author Chris Jackson
 * @since 1.4.0
 * 
 */

public class DefaultChartProvider implements ChartProvider {

  private static final Logger logger = LoggerFactory.getLogger(DefaultChartProvider.class);

  protected static final Color[] LINECOLORS = new Color[] { Color.RED, Color.GREEN, Color.BLUE, Color.MAGENTA,
      Color.ORANGE, Color.CYAN, Color.PINK, Color.DARK_GRAY, Color.YELLOW };
  protected static final Color[] AREACOLORS = new Color[] { new Color(255, 0, 0, 30), new Color(0, 255, 0, 30),
      new Color(0, 0, 255, 30), new Color(255, 0, 255, 30), new Color(255, 128, 0, 30),
      new Color(0, 255, 255, 30), new Color(255, 0, 128, 30), new Color(255, 128, 128, 30),
      new Color(255, 255, 0, 30) };

```

---

<div class="post-metadata">

**Author:** ![poertner](https://community.openhab.org/user_avatar/community.openhab.org/poertner/32/160_2.png) [@poertner](https://community.openhab.org/u/poertner)\
**Post date:** [April 1, 2016, 11:54pm UTC](https://community.openhab.org/t/chart-line-colors/4479/4 "2016-04-01T23:54:06Z")

</div>

ok, nevermind!

i found a quick fix which “improves” my design: just with html and css i can invert all colors of that white chart \*.png.  
`style="filter: invert(100%);`

great!!! 😋

 ![](https://community-openhab-org.s3-eu-central-1.amazonaws.com/original/2X/7/7b46ac9c277a39aa7bd0341165d7c6b3e0088a1e.jpg)

---

<div class="post-metadata">

**Author:** ![NCO](https://community.openhab.org/user_avatar/community.openhab.org/nco/32/55938_2.png) [@NCO](https://community.openhab.org/u/NCO)\
**Post date:** [June 21, 2016, 9:26am UTC](https://community.openhab.org/t/chart-line-colors/4479/5 "2016-06-21T09:26:06Z")

</div>

Looks great!  
Ist this the dashboard based on [dashing.io](http://dashing.io)?  
Thanks.  
Best regards,  
NCO

---

<div class="post-metadata">

**Author:** ![poertner](https://community.openhab.org/user_avatar/community.openhab.org/poertner/32/160_2.png) [@poertner](https://community.openhab.org/u/poertner)\
**Post date:** [June 21, 2016, 10:45am UTC](https://community.openhab.org/t/chart-line-colors/4479/6 "2016-06-21T10:45:49Z")

</div>

Yes, it’s dashing 😉
