willdale / SwiftUICharts

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

How can I change touchOverlay line color #212

Open erdemildiz opened 2 years ago

erdemildiz commented 2 years ago

Hello, I can change infobox style with below codes

BarChartStyle(
            infoBoxPlacement: .floating,
            infoBoxValueFont: .system(size: 12),
            infoBoxBackgroundColour: .red,
            infoBoxBorderColour: .blue,
            infoBoxBorderStyle: .init(lineWidth: 5),
            xAxisLabelFont: .system(size: 10),
            xAxisLabelsFrom: .dataPoint(rotation: .degrees(-45)),
            yAxisGridStyle: gridStyle,
            yAxisLabelPosition: .leading,
            yAxisLabelFont: .system(size: 10),
            baseline: .zero,
            topLine: .maximumValue)

but I can't change touchoverlay color. Is there any way to change this color?

Simulator Screen Shot - iPhone 13 mini - 2022-07-05 at 13 52 52

erdemildiz commented 2 years ago

@willdale Could you help me?

tsudan commented 1 year ago

the BarChartStyle has a property markerType which will accept the MarkerType enum where we can set the color of the marker as well as its stroke style.

BarChartStyle (
    ...
    markerType: .vertical(colour: .red, style: StrokeStyle()),
    ...
)

The followings are different values for markerType

public enum BarMarkerType: MarkerType {

    /// No overlay markers.
    case none

    /// Vertical line from top to bottom.
    case vertical(colour: Color = Color.primary, style: StrokeStyle = StrokeStyle())

    /// Full width and height of view intersecting at a specified point.
    case full(colour: Color = Color.primary, style: StrokeStyle = StrokeStyle())

    /// From bottom and leading edges meeting at a specified point.
    case bottomLeading(colour: Color = Color.primary, style: StrokeStyle = StrokeStyle())

    /// From bottom and trailing edges meeting at a specified point.
    case bottomTrailing(colour: Color = Color.primary, style: StrokeStyle = StrokeStyle())

    /// From top and leading edges meeting at a specified point.
    case topLeading(colour: Color = Color.primary, style: StrokeStyle = StrokeStyle())

    /// From top and trailing edges meeting at a specified point.
    case topTrailing(colour: Color = Color.primary, style: StrokeStyle = StrokeStyle())
}