Changing axis label color in LightningChart JS

2020-04-11 05:25发布

问题:

The chart appears with dark background, axis numeric labels in grid positions are yellow.

How do I change axis label colors to white?

E.g. in this example https://www.arction.com/lightningchart-js-interactive-examples/#edit/lcjs_example_0001_simpleScatter

I'm trying

chart.getDefaultAxisX()
  .setInterval(0, 92 * dataFrequency)
  .setTickStyle((visibleTicks) => visibleTicks
              .setLabelFillStyle( color: ColorRGBA(255, 255, 255) })
             )

But it's giving SyntaxError: Unexpected token, expected ","

回答1:

According to the documentation it expects you to pass FillStyle, not just color. The solution for your case is as follows:

chart.getDefaultAxisX()
  .setInterval(0, 92 * dataFrequency)
  .setTickStyle( (visibleTicks) => visibleTicks
                     .setLabelFillStyle( 
                         new SolidFill( { color: ColorRGBA(255, 255, 255) } )
                     )
               )