The chart view lets you harness Swift Charts in your project. You can customize the type, style, legend, and more to visualize data within your app.
Right now, you create your own data sets with our properties, but in the future, you’ll be able to import your own data.
There are four types of charts: Line, Area, Plot, and Bar. Each shows the same data but visualizes it differently.
If you’re using a Line or Area chart, you can adjust the chart’s interpolation, which is the way your line behaves between data points. There are three options:
Monotone creates a smooth line by “guessing” the values between data points based on known data points.
Linear connects a straight line between each data point, creating a jagged path. It’s clear to a viewer where the data points are.
Step creates a vertical line in between each data point, connecting one point to the next with a step like shape.
Choose an Increasing, Decreasing, Steady, or Random shape for your chart using the Shape property. This property adjusts the data to display the desired story from your data.
Choose the number of data points for each series. You can have as few as two points or as many as 100.
Adjust the amount of variability in your data using the Noise property. Less noise means the data is closer to the same and more noise means the data varies more.
Choose the number of series you want to be displayed in your chart. Each series is a different line, bar, dot, or area depending on your chart type. You can have as few as one series or as many as five.
If you’re using a Bar or Area chart, you can adjust the chart’s stacking. There are three options in addition to Default:
Centered stacks the series in the middle of the chart vertically.
100% stacks the charts to fill 100% of the vertical space by making the area/height proportional.
Overlapping stacks the charts on top of each other. This can look cool with lower opacity colors.
There are several properties with the Legend property that you can edit if you’ve turned on the Display Legend property.
Choose if your legend is at the top of the chart, the bottom of the chart, or overlay in the center on top of the data.
Choose if your legend is aligned to the left (leading), center, or right (trailing) of your chart.
Label each data set (series) in your chart. Each label should go in the same text field separated by a comma. For example, “Item 1, Item 2, Item 3”.
If you enter more labels than you have series, the additional labels will be removed. If you enter fewer labels than you have series, Play will automatically label the remaining series Item X, Y, Z, etc.
Adjust the gap between each item in your legend using your Spacing styles.
The Axes property opens a sub-panel with several switches that specify what information appears on your chart. You can turn on and off the gridlines, ticks, and labels for the X & Y axis. You can also change the orientation of your labels if they are visible.
You can assign a color to each series. Each color uses one of your Color styles.