willdale / SwiftUICharts

A charts / plotting library for SwiftUI. Works on macOS, iOS, watchOS, and tvOS and has accessibility features built in.
MIT License
843 stars 105 forks source link

Different Styling (solid colors) in single LineChart? #156

Closed kunalverma25 closed 2 years ago

kunalverma25 commented 2 years ago

Is it possible to create something like this? Have a different styling above and beneath yAxisPOI/Avg Markers? 1A104B92-A837-4541-99F2-9C843CD0C647

kunalverma25 commented 2 years ago

This is possible via using gradient stops of single colors in line style like:

LineStyle(lineColour: ColourStyle(stops: [
                GradientStop(color: .orange, location: 0.0), 
                GradientStop(color: .orange, location: 0.5), 
                GradientStop(color: .green, location: 0.5), 
                GradientStop(color: .green, location: 1)
                ], 
           startPoint: .top, endPoint: .bottom), lineType: .line)

Edited the issue title to reflect the same, closing it. And adding the snippet so it might help someone.