iOS Charts: Adding fill color below a line in Version 4

Viewed 18

I am updating to iOS Charts version 4. Adding the fill color below a line in a line chart seems to have changed because I get the error:

The old approach that worked for me...

userTotalEmissionsDataSet.fill = Fill(CGColor: colorLight.cgColor)

...now gives this error --> 'any Fill' cannot be constructed because it has no accessible initializers

What is the new approach? Thanks!

Context:

let userVehicleDataSet = LineChartDataSet(entries: userVehicleEmissionsChartDataArray)
    userVehicleDataSet.drawCirclesEnabled = false
    userVehicleDataSet.mode = .linear
    userVehicleDataSet.setColor(colorVehicleTravel)
    xc
    userVehicleDataSet.fillAlpha = 1.0
    userVehicleDataSet.drawFilledEnabled = true
1 Answers

Use .fillColor and not .fill

dataSet.fillColor = yourColor
Related