How to change line colors of chart in Chartist.js
Asked Answered
Z

1

6

I'm currently using Chartist.js, But I can't change the default line colors of Chart.

Chartist.js

Sample Chart Image

For SIMPLE LINE CHART I've tried:

.ct-series-a .ct-line{
    background-color: blue;
}

But It brings no result. How to fix this?

Zel answered 15/4, 2017 at 23:6 Comment(1)
This question has been answered here: #35402643. You need to override the correct css classes (they are slightly longer than yours).Atherosclerosis
S
8

Try this:

.ct-series-a .ct-line {
  /* Set the colour of this series line */
  stroke: red;
  /* Control the thikness of your lines */
  stroke-width: 5px;
  /* Create a dashed line with a pattern */
  stroke-dasharray: 10px 20px;
}

https://gionkunz.github.io/chartist-js/getting-started.html#customizing-the-default-css

Smattering answered 30/11, 2017 at 19:4 Comment(2)
Diego, you can add some explanation to enrich the resolution for future use.Menial
Is it possible to use background image ?Malaysia

© 2022 - 2024 — McMap. All rights reserved.