Ngx-charts: A way to change the color for axis and ticks

Created on 2 Sep 2017  路  6Comments  路  Source: swimlane/ngx-charts

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[x] support request => Please do not submit support request here

I'm trying to implement ngx-charts with a dark background, and I was unable to find a way to change the text color for ticks and axis.

I tried changing with CSS but it is not working.

Is there a way to change that colors?

Thanks

Most helpful comment

in angular dont forget to go deeper in sass using ::ng-deep

::ng-deep .ngx-charts { 
    text{
        fill: #fff!important; 
    }
}

All 6 comments

I changed the text color on graphs by using this css: .ngx-charts text { fill: #fff; }

You should be able to change the axis and label colors using CSS. Make sure the CSS you write to override this is not loaded before the chart's CSS. Or use !important

in angular dont forget to go deeper in sass using ::ng-deep

::ng-deep .ngx-charts { 
    text{
        fill: #fff!important; 
    }
}

in angular dont forget to go deeper in sass using ::ng-deep

::ng-deep .ngx-charts { 
    text{
        fill: #fff!important; 
    }
}

It worked for me thanks

Simplest way

<ngx-charts-bar-horizontal
      [results]="results"
      [scheme]="colorScheme"
      [results]="single"
      [gradient]="gradient"
      [xAxis]="showXAxis"
      [yAxis]="showYAxis"
      [legend]="showLegend"
      [showXAxisLabel]="showXAxisLabel"
      [showYAxisLabel]="showYAxisLabel"
      [xAxisLabel]="xAxisLabel"
      [yAxisLabel]="yAxisLabel"
      (select)="onSelect($event)"
      style="fill: grey;">   <----------------------- HERE
    </ngx-charts-bar-horizontal> 

This worked for me.. Thank You! :)

Was this page helpful?
0 / 5 - 0 ratings