Skip to content

Instantly share code, notes, and snippets.

@navsing
Created January 7, 2023 19:51
Show Gist options
  • Save navsing/ca19e1b9cee3caab53f039ffdec3262d to your computer and use it in GitHub Desktop.
Save navsing/ca19e1b9cee3caab53f039ffdec3262d to your computer and use it in GitHub Desktop.
//Base Components
Chart(data) { i in
LineMark(
x: .value("x-axis", i.year),
y: .value("y-axis", i.awards)
)
}
//Customization to try on the line component
.lineStyle(StrokeStyle(lineWidth: 2)) // add stroke to the line
.foregroundStyle(.blue) // add color to the line
.interpolationMethod(.linear) //try playing with .cardinal, .linear, .monotone etc.
.symbol(Circle()) //customize symbols - change color, stroke etc.
.symbolSize(10)
//Customization to try on the chart component
.chartXAxis(.automatic)
.chartYAxis(.hidden) //show or hide axis
.chartLegend(.automatic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment