SwiftUICharts - A charts / plotting library for SwiftUI.

Overview

SwiftUICharts

A charts / plotting library for SwiftUI. Works on macOS, iOS, watchOS, and tvOS and has accessibility and Localization features built in.

Demo Project

Documentation

Chart Types

Line Charts

Line Chart

Example of Line Chart

Uses LineChartData data model.

LineChart(chartData: LineChartData)

Filled Line Chart

Example of Filled Line Chart

Uses LineChartData data model.

FilledLineChart(chartData: LineChartData)

Multi Line Chart

Example of Multi Line Chart

Uses MultiLineChartData data model.

MultiLineChart(chartData: MultiLineChartData)

Ranged Line Chart

Example of Ranged Line Chart

Uses RangedLineChart data model.

RangedLineChart(chartData: RangedLineChartData)

Bar Charts

Bar Chart

Example of Bar Chart

Uses BarChartData data model.

BarChart(chartData: BarChartData)

Range Bar Chart

Example of Range Bar Chart

Uses RangedBarChartData data model.

RangedBarChart(chartData: RangedBarChartData)

Grouped Bar Chart

Example of Grouped Bar Chart

Uses GroupedBarChartData data model.

GroupedBarChart(chartData: GroupedBarChartData)

Stacked Bar Chart

Example of Stacked Bar Chart

Uses StackedBarChartData data model.

StackedBarChart(chartData: StackedBarChartData)

Pie Charts

Pie Chart

Example of Pie Chart

Uses PieChartData data model.

PieChart(chartData: PieChartData)

Doughnut Chart

Example of Doughnut Chart

Uses DoughnutChartData data model.

DoughnutChart(chartData: DoughnutChartData)

Documentation

Installation

Swift Package Manager

File > Swift Packages > Add Package Dependency...
import SwiftUICharts

If you have trouble with views not updating correctly, add .id() to your View.

LineChart(chartData: LineChartData)
    .id(LineChartData.id)

View Modifiers

The order of the view modifiers is some what important as the modifiers are various types of stacks that wrap around the previous views.


All Chart Types

Touch Overlay

Detects input either from touch of pointer. Finds the nearest data point and displays the relevent information where specified.

The location of the info box is set in ChartStyle -> infoBoxPlacement.

.touchOverlay(chartData: CTChartData, specifier: String, unit: TouchUnit)
  • chartData: Chart data model.
  • specifier: Decimal precision for labels.
  • unit: Unit to put before or after the value.

Setup within Chart Data --> Chart Style


Info Box

Displays the information from Touch Overlay if InfoBoxPlacement is set to .infoBox.

The location of the info box is set in ChartStyle -> infoBoxPlacement.

.infoBox(chartData: CTChartData)
  • chartData: Chart data model.

Floating Info Box

Displays the information from Touch Overlay if InfoBoxPlacement is set to .floating.

The location of the info box is set in ChartStyle -> infoBoxPlacement.

.floatingInfoBox(chartData: CTChartData)
  • chartData: Chart data model.

Header Box

Displays the metadata about the chart, set in Chart Data -> ChartMetadata

Displays the information from Touch Overlay if InfoBoxPlacement is set to .header.

The location of the info box is set in ChartStyle -> infoBoxPlacement.

.headerBox(chartData: CTChartData)

Legends

Displays legends.

.legends()

Lays out markers over each of the data point.


Line and Bar Charts

Average Line

Shows a marker line at the average of all the data points.

.averageLine(chartData: CTLineBarChartDataProtocol,
             markerName: "Average",
             labelPosition: .yAxis(specifier: "%.0f"),
             lineColour: .primary,
             strokeStyle: StrokeStyle(lineWidth: 3, dash: [5,10]))
  • chartData: Chart data model.
  • markerName: Title of marker, for the legend.
  • labelPosition: Option to display the markers’ value inline with the marker.
  • labelColour: Colour of the Text.
  • labelBackground: Colour of the background.
  • lineColour: Line Colour.
  • strokeStyle: Style of Stroke.

Y Axis Point Of Interest

Configurable Point of interest

.yAxisPOI(chartData: CTLineBarChartDataProtocol,
          markerName: "Marker",
          markerValue: 123,
          labelPosition: .center(specifier: "%.0f"),
          labelColour: Color.black,
          labelBackground: Color.orange,
          lineColour: Color.orange,
          strokeStyle: StrokeStyle(lineWidth: 3, dash: [5,10]))
  • chartData: Chart data model.
  • markerName: Title of marker, for the legend.
  • markerValue: Value to mark
  • labelPosition: Option to display the markers’ value inline with the marker.
  • labelColour: Colour of the Text.
  • labelBackground: Colour of the background.
  • lineColour: Line Colour.
  • strokeStyle: Style of Stroke.
  • Returns: A new view containing the chart with a marker line at a specified value.

X Axis Grid

Adds vertical lines along the X axis.

.xAxisGrid(chartData: CTLineBarChartDataProtocol)

Setup within ChartData -> ChartStyle.


Y Axis Grid

Adds horizontal lines along the Y axis.

.yAxisGrid(chartData: CTLineBarChartDataProtocol)

Setup within ChartData -> ChartStyle.


X Axis Labels

Labels for the X axis.

.xAxisLabels(chartData: CTLineBarChartDataProtocol)

Setup within ChartData -> ChartStyle.


Y Axis Labels

Automatically generated labels for the Y axis

.yAxisLabels(chartData: CTLineBarChartDataProtocol, specifier: "%.0f")
  • specifier: Decimal precision specifier.

Setup within ChartData -> ChartStyle.

yAxisLabelType:

case numeric // Auto generated, numeric labels.
case custom // Custom labels array

Custom is set from ChartData -> yAxisLabels


Linear Trend Line

A line across the chart to show the trend in the data.

.linearTrendLine(chartData: CTLineBarChartDataProtocol,
                 firstValue: Double,
                 lastValue: Double,
                 lineColour: ColourStyle,
                 strokeStyle: StrokeStyle)

Line Charts

Point Markers

Lays out markers over each of the data point.

.pointMarkers(chartData: CTLineChartDataProtocol)

Setup within Data Set -> PointStyle.


Filled Top Line

Adds an independent line on top of FilledLineChart.

.filledTopLine(chartData: LineChartData,
               lineColour: ColourStyle,
               strokeStyle: StrokeStyle)

Allows for a hard line over the data point with a semi opaque fill.


Examples

Line Chart

LineChartData { let data = LineDataSet(dataPoints: [ LineChartDataPoint(value: 12000, xAxisLabel: "M", description: "Monday"), LineChartDataPoint(value: 10000, xAxisLabel: "T", description: "Tuesday"), LineChartDataPoint(value: 8000, xAxisLabel: "W", description: "Wednesday"), LineChartDataPoint(value: 17500, xAxisLabel: "T", description: "Thursday"), LineChartDataPoint(value: 16000, xAxisLabel: "F", description: "Friday"), LineChartDataPoint(value: 11000, xAxisLabel: "S", description: "Saturday"), LineChartDataPoint(value: 9000, xAxisLabel: "S", description: "Sunday") ], legendTitle: "Steps", pointStyle: PointStyle(), style: LineStyle(lineColour: ColourStyle(colour: .red), lineType: .curvedLine)) let metadata = ChartMetadata(title: "Step Count", subtitle: "Over a Week") let gridStyle = GridStyle(numberOfLines: 7, lineColour : Color(.lightGray).opacity(0.5), lineWidth : 1, dash : [8], dashPhase : 0) let chartStyle = LineChartStyle(infoBoxPlacement : .infoBox(isStatic: false), infoBoxBorderColour : Color.primary, infoBoxBorderStyle : StrokeStyle(lineWidth: 1), markerType : .vertical(attachment: .line(dot: .style(DotStyle()))), xAxisGridStyle : gridStyle, xAxisLabelPosition : .bottom, xAxisLabelColour : Color.primary, xAxisLabelsFrom : .dataPoint(rotation: .degrees(0)), yAxisGridStyle : gridStyle, yAxisLabelPosition : .leading, yAxisLabelColour : Color.primary, yAxisNumberOfLabels : 7, baseline : .minimumWithMaximum(of: 5000), topLine : .maximum(of: 20000), globalAnimation : .easeOut(duration: 1)) return LineChartData(dataSets : data, metadata : metadata, chartStyle : chartStyle) } } ">
struct LineChartDemoView: View {
    
    let data : LineChartData = weekOfData()
    
    var body: some View {
        VStack {
            LineChart(chartData: data)
                .pointMarkers(chartData: data)
                .touchOverlay(chartData: data, specifier: "%.0f")
                .yAxisPOI(chartData: data,
                          markerName: "Step Count Aim",
                          markerValue: 15_000,
                          labelPosition: .center(specifier: "%.0f"),
                          labelColour: Color.black,
                          labelBackground: Color(red: 1.0, green: 0.75, blue: 0.25),
                          lineColour: Color(red: 1.0, green: 0.75, blue: 0.25),
                          strokeStyle: StrokeStyle(lineWidth: 3, dash: [5,10]))
                .yAxisPOI(chartData: data,
                          markerName: "Minimum Recommended",
                          markerValue: 10_000,
                          labelPosition: .center(specifier: "%.0f"),
                          labelColour: Color.white,
                          labelBackground: Color(red: 0.25, green: 0.75, blue: 1.0),
                          lineColour: Color(red: 0.25, green: 0.75, blue: 1.0),
                          strokeStyle: StrokeStyle(lineWidth: 3, dash: [5,10]))
                .averageLine(chartData: data,
                             strokeStyle: StrokeStyle(lineWidth: 3, dash: [5,10]))
                .xAxisGrid(chartData: data)
                .yAxisGrid(chartData: data)
                .xAxisLabels(chartData: data)
                .yAxisLabels(chartData: data)
                .infoBox(chartData: data)
                .headerBox(chartData: data)
                .legends(chartData: data, columns: [GridItem(.flexible()), GridItem(.flexible())])
                .id(data.id)
                .frame(minWidth: 150, maxWidth: 900, minHeight: 150, idealHeight: 250, maxHeight: 400, alignment: .center)
        }
        .navigationTitle("Week of Data")
    }
    
    static func weekOfData() -> LineChartData {
        let data = LineDataSet(dataPoints: [
            LineChartDataPoint(value: 12000, xAxisLabel: "M", description: "Monday"),
            LineChartDataPoint(value: 10000, xAxisLabel: "T", description: "Tuesday"),
            LineChartDataPoint(value: 8000,  xAxisLabel: "W", description: "Wednesday"),
            LineChartDataPoint(value: 17500, xAxisLabel: "T", description: "Thursday"),
            LineChartDataPoint(value: 16000, xAxisLabel: "F", description: "Friday"),
            LineChartDataPoint(value: 11000, xAxisLabel: "S", description: "Saturday"),
            LineChartDataPoint(value: 9000,  xAxisLabel: "S", description: "Sunday")
        ],
        legendTitle: "Steps",
        pointStyle: PointStyle(),
        style: LineStyle(lineColour: ColourStyle(colour: .red), lineType: .curvedLine))
        
        let metadata   = ChartMetadata(title: "Step Count", subtitle: "Over a Week")
        
        let gridStyle  = GridStyle(numberOfLines: 7,
                                   lineColour   : Color(.lightGray).opacity(0.5),
                                   lineWidth    : 1,
                                   dash         : [8],
                                   dashPhase    : 0)
        
        let chartStyle = LineChartStyle(infoBoxPlacement    : .infoBox(isStatic: false),
                                        infoBoxBorderColour : Color.primary,
                                        infoBoxBorderStyle  : StrokeStyle(lineWidth: 1),
                                        
                                        markerType          : .vertical(attachment: .line(dot: .style(DotStyle()))),
                                        
                                        xAxisGridStyle      : gridStyle,
                                        xAxisLabelPosition  : .bottom,
                                        xAxisLabelColour    : Color.primary,
                                        xAxisLabelsFrom     : .dataPoint(rotation: .degrees(0)),
                                        
                                        yAxisGridStyle      : gridStyle,
                                        yAxisLabelPosition  : .leading,
                                        yAxisLabelColour    : Color.primary,
                                        yAxisNumberOfLabels : 7,
                                        
                                        baseline            : .minimumWithMaximum(of: 5000),
                                        topLine             : .maximum(of: 20000),
                                        
                                        globalAnimation     : .easeOut(duration: 1))
        
        return LineChartData(dataSets       : data,
                             metadata       : metadata,
                             chartStyle     : chartStyle)
        
    }
}

Accessibility

Inside certain elements are additional tags to help describe the chart for VoiceOver.

See Localization of Accessibility

Localization

All labels support localization. There are, however, some hidden labels that are there to support VoiceOver. See Localization of Accessibility

Localization of Accessibility

See the localization demo in the Demo Project.


Voice over description of a datapoint when the user touches the area closest to the data point. The VoiceOver will say , , .

" = "%@, "; ">
"%@ 
    
     "
     = "%@, 
    
     "
    ;

Read out before a poiMarker. The VoiceOver will say

, , .

"P-O-I-Marker" = "P O I Marker";
"Average" = "Average";

Voice over description of a poiMarker. The VoiceOver will say , , .

%@" = "local_marker_legend_title, %@"; ">
"
    
      %@
     "
     = "local_marker_legend_title, %@";

Read out before a axisLabel. The VoiceOver will say , .

"X-Axis-Label" = "X Axis Label";
"Y-Axis-Label" = "Y Axis Label";

Read out before a legend. The VoiceOver will say , .

"Line-Chart-Legend" = "Line Chart Legend";
"P-O-I-Marker-Legend" = "P O I Marker Legend";
"Bar-Chart-Legend" = "Bar Chart Legend";
"P-O-I-Marker-Legend" = "P O I Marker Legend";
"Pie-Chart-Legend" = "Pie Chart Legend";
"P-O-I-Marker-Legend" = "P O I Marker Legend";
Comments
  • Linechart not plotting correctly with large number of points

    Linechart not plotting correctly with large number of points

    Is there some number of data points that are too much for a line chart? I'm loading 609 heart rates here, the first chart is using iOS charts and the 2nd is using SwiftUI Charts. It looks like the spike in the middle (a workout) should be tighter together). Anything I can do to fix this? 🤔
    IMG_57212197C1E8-1 IMG_95BBF270A45B-1

    bug 
    opened by gesabo 20
  • Adding a trend line to Line Charts and Bar Charts?

    Adding a trend line to Line Charts and Bar Charts?

    @willdale have you considered adding a trend line or moving average line? I've done this in the past in the iOS Charts lib manually by adding another line with data points that average some number of total points on the chart. For example if I had 100 data points on line 1, line 2 would be constructed using 10 data points (0-10 average = point 1, 11-21 = point 2 etc.).

    If you were to incorporate this in the library then maybe add a number to pass in for granularity, i.e. adding a trend line like my example above would pass in maybe the number 10, as in every 10 data points and more granularity might be 5, so that the trend line represented the average of every 5 data points. I think this would be a nice feature to add if not too difficult to incorporate, both for line charts but bar charts and ranged bar charts as well. Thanks for considering!

    opened by gesabo 15
  • Rotation on Line Chart with large no points, causes y axis to shift off page

    Rotation on Line Chart with large no points, causes y axis to shift off page

    Sorry, Will. Reopening. Updated to 2.6.1

    Using, xAxisLabelsFrom : .chartData(rotation: .degrees(90)), still forces y axis off screen. Using, xAxisLabelsFrom :.chartData(), causes labels to disappear. See two images below. Let me know how I can be of help.

    image image

    opened by kennedycraig 15
  • X-Axis labels truncate

    X-Axis labels truncate

    The label text truncates, makes it a little harder to read at a glance as users would have to tap each bar to see the full text. Would be great to have an option to display X-axis labels rotated at n-degrees and showing full text (no truncating)

    opened by geeklingo 13
  • BarChartStyle  xAxisLabelsFrom  dataPoints not showing?

    BarChartStyle xAxisLabelsFrom dataPoints not showing?

    I noticed in your demo project for a ranged bar chart, you hard code the xAxisLabels xAxisLabels: ["00:00", "12:00", "00:00"] but I would like to load them dynamically from my data points as in xAxisLabelsFrom : .dataPoint(rotation: .degrees(0)) but they aren't showing up. Am I doing something wrong or is this not possible yet? Here is a gist of my code, apologies for the cruft, work in progress...

    https://gist.github.com/gesabo/9dc3758cd167544c953953e70a31b4b6

    bug 
    opened by gesabo 12
  • Y axis labels and legend pushed off view with large data no. of data points

    Y axis labels and legend pushed off view with large data no. of data points

    I am experiencing the behavior that y axis labels are starting to be pushed outside the view as I increase the number of data points. 30 datapoints are fine but as I increase beyond 30, the labels begin to be pushed out. Have I hit a limit? labelmissing

    bug 
    opened by kennedycraig 12
  • Custom Dot Colors based on the Data

    Custom Dot Colors based on the Data

    I couldn't find a way to do this yet but it would be nice if you were able to customize the Dot color on a Line Chart in that way that had access to the data so that e.g. on a yAxis of 0-10 3 was red, 5 was yellow, 8 was green etc.

    enhancement 
    opened by gesabo 10
  • Space Between Bars (Issue with many Bars)

    Space Between Bars (Issue with many Bars)

    Hi,

    first of all: Great Library! It's by far the most flexible out there in pure SwiftUI!

    I ran into one issue with the bar chart, that is hopefully easy to fix although I didn't find the right place, yet.

    If you have many data points the bars extend the space of the diagram. You can transform the bars as such by giving it a bar width <1 but that leads to huge spaces between the bars (of course). Is there a way to make the entire bars "thinner"?

    Examples

    Not so many bars image

    Bildschirmfoto 2021-05-05 um 19 08 50

    Kind regards!

    opened by tfeige91 10
  • I can only display LineChart once.

    I can only display LineChart once.

    Environment: SwiftUI via Xcode 12.4

    I tried to redisplay the LineChart graph with new data; but additional renderings didn't happen.

    One band-aid approach is to launch another LineChart graph in place of the original for the new data. This works; but is totally inefficient for multiple sets of data; and I still can't re-render already-rendered LineCharts(). Which means I have to have a LineChart() for EACH set of chartData.

    The data is loaded from a class object and imported via @ObservedObject var dataSource = DataStuff()'s Published var.

    Here's the code snippet with two different data sources:

    ...
     VStack {
                    if dataSource.chartData != nil {
                        if graphToggle {
                        LineChart()
                            .touchOverlay(specifier: "%.2f")
                            .yAxisGrid()
                            .xAxisLabels()
                            .yAxisLabels()
                            .headerBox()
                            .legends()
                            .environmentObject(dataSource.chartData!)
                            .frame(minWidth: 300, maxWidth: 900, minHeight: 300, idealHeight: 400, maxHeight: 500, alignment: .center)
                            .padding(.all, 24)
                            .padding(.top, 12)
                        } else {
                            LineChart()
                                .touchOverlay(specifier: "%.2f")
                                .yAxisGrid()
                                .xAxisLabels()
                                .yAxisLabels()
                                .headerBox()
                                .legends()
                                .environmentObject(dataSource.chartData!)
                                .frame(minWidth: 300, maxWidth: 900, minHeight: 300, idealHeight: 400, maxHeight: 500, alignment: .center)
                                .padding(.all, 24)
                                .padding(.top, 12)
                        }
                        Spacer()
                    }
                    Spacer()
                    ...
    

    Do you know how I can reuse this code with fresh data within SwiftUI?

    P.S. I tried to create a replacement instance of LineChart() for the new graph; doesn't work:

    Button {
                       lineChart = nil
                       lineChart = LineChart()
                       dataSource.loadChartData1()
    }
    
    opened by UncleRic 10
  • Animation Keeps Redrawing (iOS 15)

    Animation Keeps Redrawing (iOS 15)

    https://user-images.githubusercontent.com/10380669/141681990-d107a625-413c-42b3-9d06-8b23b4e5e73f.mov

    Hi Will, I could use some suggestions on this one. Since upgrading devices to ios15, I see an issue with animations redrawing themselves on some charts. There is no animation explicitly provided for the view. Interestingly, I don't see the behavior in the simulator. If I try to turn off the animation using ios15 syntax .animation(nil, value: 0) - there is no impact. If I use the deprecated syntax: .animation(nil). The animation is disabled and doesn't redraw. Any suggestions on where I might go to debug/change this?

    opened by kennedycraig 8
  • Chart in ScrollView - Cannot initiate scroll from chart

    Chart in ScrollView - Cannot initiate scroll from chart

    When I add a line chart with the touchoverlay enabled into a scrollview, I find that I can only scroll when I start the scroll gesture outside of the chart. Is this expected behavior?

    opened by mgauthier 8
  • Labels Positioning Issue

    Labels Positioning Issue

    Hi, is there any way i can achieve this output?

    Screenshot 2022-11-15 at 4 57 21 PM

    I have made it almost work but confused about the labels position above point markers.

    Screenshot 2022-11-15 at 5 05 05 PM

    Code:

    fileprivate struct TemperatureChart: View {
        var chartData : LineChartData
        var body: some View {
            FilledLineChart(chartData: chartData)
                .filledTopLine(chartData: chartData,
                               lineColour: ColourStyle(colour: Color(hex: "8D608E")),
                               strokeStyle: StrokeStyle(lineWidth: 3))
                .pointMarkers(chartData: chartData)
                .xAxisLabels(chartData: chartData)
            
                .modifier(CustomXAxisPOI(data: chartData, markerName: "24°", markerValue: 0))
                .modifier(CustomXAxisPOI(data: chartData, markerName: "22°", markerValue: 1))
                .modifier(CustomXAxisPOI(data: chartData, markerName: "26°", markerValue: 2))
                .modifier(CustomXAxisPOI(data: chartData, markerName: "25°", markerValue: 3))
                .modifier(CustomXAxisPOI(data: chartData, markerName: "27°", markerValue: 4))
                .modifier(CustomXAxisPOI(data: chartData, markerName: "28°", markerValue: 5))
        }
    }
    
    struct CustomXAxisPOI: ViewModifier {
        var data: LineChartData
        var markerName: String
        var markerValue: Int
        
        func body(content: Content) -> some View {
            content
                .xAxisPOI(chartData: data,
                          markerName: markerName,
                          markerValue: markerValue,
                          dataPointCount: 6,
                          lineColour: .clear,
                          labelPosition: .center(specifier: "%.2f"),
                          labelFont: .system(size: 18),
                          labelColour: Color(hex: "8D608E"),
                          labelBackground: .clear,
                          padding: 5)
        }
    }
    

    and the dataset:

    func getTestData() -> LineChartData {
            let data = LineDataSet(dataPoints: [
                LineChartDataPoint(value: 24, xAxisLabel: "Mon", description: "Monday"),
                LineChartDataPoint(value: 22, xAxisLabel: "Tue", description: "Tuesday"),
                LineChartDataPoint(value: 26 , xAxisLabel: "Wed", description: "Wednesday"),
                LineChartDataPoint(value: 25 , xAxisLabel: "Thu", description: "Thursday"),
                LineChartDataPoint(value: 27 , xAxisLabel: "Fri", description: "Friday"),
                LineChartDataPoint(value: 28 , xAxisLabel: "Sat", description: "Saturday")
            ],
                                   legendTitle: "Steps",
                                   pointStyle: PointStyle(pointSize: 10,
                                                          borderColour: .white,
                                                          fillColour: Color(hex: "8D608E"), lineWidth: 2,
                                                          pointType: .filled,
                                                          pointShape: .circle),
                                   style: LineStyle(lineColour: ColourStyle(colours:
                                                                                [Color(hex: "8D608E").opacity(0.30),
                                                                                 Color(hex: "8D608E").opacity(0.00)],
                                                                            startPoint: .top,
                                                                            endPoint: .bottom),
                                                    lineType: .curvedLine))
            
            let chartStyle = LineChartStyle(
                xAxisLabelPosition  : .bottom,
                xAxisLabelColour    : Color(hex: "8D608E"),
                yAxisLabelColour    : Color.white,
                globalAnimation     : .easeOut(duration: 1))
            
            return LineChartData(dataSets: data, chartStyle: chartStyle)
        }
    

    My main concern is to place the labels above the respective point markers. Tried different DisplayValue values but did not succeeded.

    and also can i remove the border line above xAxis Labels?

    Any help would be much appreciated. Thanks.

    opened by mehroozkhan 0
  • Any way to add panning

    Any way to add panning

    Hi there

    Thanks for this awesome SDK. I really like it. ❤️ I would like to hear, if there is some way of adding panning-support to a graph? Any plans for it? Any ideas how one would go about it?

    Again thanks for the great work 🙌

    opened by rohdester 0
  • Update How VoiceOver Announces Grouped Bar Charts

    Update How VoiceOver Announces Grouped Bar Charts

    Using the contain option for the .accessibilityElement(children: ) modifier. with an accessibility label. That way, the first time that the focus moves to one of the elements in the chart, the title of the chart will be announced preceding the accessibility label and value for the bar. Update the bars so it announces the title for the group of the data point instead of the title of the chart every time.

    This way, it seems to be a bit less redundant and it provides instead important information, to what legend item corresponds each one of the bars.

    Before:

    https://user-images.githubusercontent.com/2143610/188285605-f8741f77-77e8-49b0-ad39-76da27dec4fa.MP4

    After:

    https://user-images.githubusercontent.com/2143610/188285665-944635b8-27b2-4691-b6d6-6614a37e9df1.MP4

    opened by dadederk 0
  • Usage of arrays of double

    Usage of arrays of double

    Hi, I would like to code a Linechart (one line). In my project, the Y and X data are each an array of double. Regarding the version 1 of SwiftUICharts, it worked find for me. But with the version 2, I don't know how to code Chardata when X & Y data are arrays. Thanks a lot for your help. Jean-Francois

    opened by Wini974 0
Releases(2.10.1)
  • 2.10.1(Jun 19, 2022)

    What's Changed

    • 189 screenshot chart in uiimage linecharts by @willdale in https://github.com/willdale/SwiftUICharts/pull/200
    • 58 top of bar charts have deformation by @willdale in https://github.com/willdale/SwiftUICharts/pull/201
    • Fixed X axis labels live updating by @anivaros in https://github.com/willdale/SwiftUICharts/pull/199
    • fix: HorizontalBarChart xAxisLabelPosition = .bottom. by @laosb in https://github.com/willdale/SwiftUICharts/pull/194
    • 206: Fix drawing for smaller numbers. by @willdale in https://github.com/willdale/SwiftUICharts/pull/209

    New Contributors

    • @anivaros made their first contribution in https://github.com/willdale/SwiftUICharts/pull/199
    • @laosb made their first contribution in https://github.com/willdale/SwiftUICharts/pull/194

    Full Changelog: https://github.com/willdale/SwiftUICharts/compare/2.10.0...2.10.1

    Source code(tar.gz)
    Source code(zip)
  • 2.10.0(Apr 27, 2022)

    What's Changed

    • Set the offset for infobox to half the height of the space. by @willdale in https://github.com/willdale/SwiftUICharts/pull/177
    • Update SwiftUICharts.podspec by @willdale in https://github.com/willdale/SwiftUICharts/pull/181
    • Revert "Revert "XAxis Label Height distortion fix"" by @willdale in https://github.com/willdale/SwiftUICharts/pull/186
    • 191: Fix redrawing of bar chart when data changes by @willdale in https://github.com/willdale/SwiftUICharts/pull/192

    Full Changelog: https://github.com/willdale/SwiftUICharts/compare/2.9.9...2.10.0

    Source code(tar.gz)
    Source code(zip)
  • 2.9.9(Mar 16, 2022)

    What's Changed

    • Revert "XAxis Label Height distortion fix" by @willdale in https://github.com/willdale/SwiftUICharts/pull/175

    Full Changelog: https://github.com/willdale/SwiftUICharts/compare/2.9.8...2.9.9

    Source code(tar.gz)
    Source code(zip)
  • 2.9.8(Mar 12, 2022)

    What's Changed

    • Added Stepped Line Style by @kunalverma25 in https://github.com/willdale/SwiftUICharts/pull/165
    • Add .position DisplayValue to show POI Labels at a certain position inside the chart + Custom Shapes for POI Labels by @kunalverma25 in https://github.com/willdale/SwiftUICharts/pull/161
    • Fixed issue where extraline skipped passed in stroke style by @kunalverma25 in https://github.com/willdale/SwiftUICharts/pull/171
    • Negative Value Visualisation fix for Bar/Grouped/Horizontal Bar Charts by @kunalverma25 in https://github.com/willdale/SwiftUICharts/pull/168
    • XAxis Label Height distortion fix by @kunalverma25 in https://github.com/willdale/SwiftUICharts/pull/167

    Full Changelog: https://github.com/willdale/SwiftUICharts/compare/2.9.7...2.9.8

    Source code(tar.gz)
    Source code(zip)
  • 2.9.7(Jan 5, 2022)

    What's Changed

    • Enabling corner radius for left/right and explicitly setting all corners by @kunalverma25 in https://github.com/willdale/SwiftUICharts/pull/158

    New Contributors

    • @kunalverma25 made their first contribution in https://github.com/willdale/SwiftUICharts/pull/158

    Full Changelog: https://github.com/willdale/SwiftUICharts/compare/2.9.6...2.9.7

    Source code(tar.gz)
    Source code(zip)
  • 2.9.6(Dec 7, 2021)

  • 2.9.5(Nov 14, 2021)

    Fixed

    • Fix baseline in multi line line chart when using ignore zero. See #133.
    • Add number formatter to touch overlay. See #130

    Other

    • Update CI

    What's Changed

    • Add concurrency rule to CI by @willdale in https://github.com/willdale/SwiftUICharts/pull/136
    • Update and rename swift.yml to ci.yml by @willdale in https://github.com/willdale/SwiftUICharts/pull/137
    • Feature/add number formatter by @willdale in https://github.com/willdale/SwiftUICharts/pull/132
    • Fix baseline in multi line line chart when using ignore zero. by @willdale in https://github.com/willdale/SwiftUICharts/pull/135
    • Update Podspec to v2.9.5 by @willdale in https://github.com/willdale/SwiftUICharts/pull/138

    Full Changelog: https://github.com/willdale/SwiftUICharts/compare/2.9.4...2.9.5

    Source code(tar.gz)
    Source code(zip)
  • 2.9.4(Nov 6, 2021)

  • 2.9.3(Sep 10, 2021)

  • 2.9.2(Sep 8, 2021)

  • 2.9.1(Aug 17, 2021)

    Fixes

    • Ensures the Extra Line data point is displayed above other shapes. See #104
    • Tidies the display of Extra Line data in Touch Overlay when used in ranged charts.
    Source code(tar.gz)
    Source code(zip)
  • 2.9.0(Aug 13, 2021)

  • 2.8.3(Jul 30, 2021)

  • 2.8.2(Jul 19, 2021)

  • 2.8.1(Jul 2, 2021)

    Adds

    • PodSpec: now available as a Cocoapod. Thanks to @simonmoser-bluesource. See #95.
    • Colour the Axis borders. Thanks to @simonmoser-bluesource. See #95.

    Fixes

    • The library should now compile in Xcode-beta 13. See #98.
    Source code(tar.gz)
    Source code(zip)
  • 2.8.0(Jun 21, 2021)

    Adds

    • Ability to set custom colours for individual Point Markers. See #85
    • Ability to add an X axis POI marker. See #84
    • Minimum movement distance and change interaction scope of touch overlay. See #30.

    Under the hood

    • Split data functions out of main protocols into their own.
    • Split POIs out of main protocols and into their own.
    Source code(tar.gz)
    Source code(zip)
  • 2.7.0(Jun 5, 2021)

    New

    • Uses the Combine framework to stream the data point from a touch interaction via a PassthroughSubject. See #85

    Fixes

    • Rename the associatedtype Set to SetType to avoid a naming conflict. -- My bad!
    • A typo: MarkerAttachemnt to MarkerAttachment. See #81 .
    Source code(tar.gz)
    Source code(zip)
  • 2.6.4(May 23, 2021)

  • 2.6.3(May 11, 2021)

  • 2.6.2(May 11, 2021)

  • 2.6.1(May 10, 2021)

  • 2.6(May 10, 2021)

    Added

    • HorizontalBarChart, see #59.
    • Ground work for other horizontal bar chart types.
    • .extraLine view modifier. This allows a line to be drawn Line Charts and Bar Charts. See #62, #67. Y axis labels are generated by:
    • .extraYAxisLabels view modifier. This is a partial fix for #68.

    .extraLine and .extraYAxisLabels are experimental at the moment and the implementation may change. They are currently undocumented.

    Fixed

    • X Axis labels should now work in all orientations as expected. See #61, #64
    • Add a small amount of padding to certain element to stop clashes.
    Source code(tar.gz)
    Source code(zip)
  • 2.5.0(Apr 26, 2021)

    Feature

    • Adds option to overlay text or icon over pie chart and doughnut chart. #53

    Bug

    • Fixes a layout bug on x axis label rotation.

    General

    • Neaten up code base.
    • Conform code to coding standard.
    • Update to foundational functions.
    • General tidy up.
    Source code(tar.gz)
    Source code(zip)
  • 2.4.1(Apr 21, 2021)

  • 2.4.0(Apr 20, 2021)

    Fixes

    • Changes how the y axis labels are worked out in the StackedBarChart. #54
    • Small changes to documentation.

    Thanks to @ataias for their work on it.

    Source code(tar.gz)
    Source code(zip)
  • 2.3.2(Apr 15, 2021)

  • 2.3.1(Apr 15, 2021)

  • 2.3.0(Mar 31, 2021)

  • 2.2.1(Mar 29, 2021)

    Fixes

    • Small layout bug in x axis labels when getting labels from chart data.
    • Improve the way ignore zero is handled.
    • Move if checks out of loops when line is drawn.
    Source code(tar.gz)
    Source code(zip)
  • 2.2.0(Mar 27, 2021)

    Features

    • Adds option for custom labels along the y axis. #40
    • Adds Linear Trend Line view modifier. #39
    • Adds styling options for touch markers. #43
    • Open out all .font() to the API.

    Fixes

    • Smooth out touch overlay when Ignore Zero is on.
    • Fixes an issue where labels on the x axis might group together. #42
    • Make the line chart Dot Marker easier to customise. #43
    Source code(tar.gz)
    Source code(zip)
Owner
Will Dale
Will Dale
SwiftUICharts - A simple line and bar charting library that supports accessibility written using SwiftUI.

SwiftUICharts - A simple line and bar charting library that supports accessibility written using SwiftUI.

Majid Jabrayilov 1.4k Jan 9, 2023
An overview of the different types of charts you can make with Swift Charts

Swift Charts Examples This repo aims to provide sample code for lots of different chart types for you to use as inspiration for your own projects. We

Jordi Bruin 1.2k Dec 30, 2022
SwiftUICharts - ChartView made in SwiftUI

SwiftUICharts Swift package for displaying charts effortlessly. V2 Beta 1 is released, if you would like to try it out you can find a demo project her

Andras Samu 4.7k Jan 1, 2023
SwiftCharts - Easy to use and highly customizable charts library for iOS

SwiftCharts Easy to use and highly customizable charts library for iOS Features: Bars - plain, stacked, grouped, horizontal, vertical Scatter Lines (s

Ivan Schütz 2.4k Jan 4, 2023
A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.

⚡ A powerful & easy to use chart library for Android ⚡ Charts is the iOS version of this library Table of Contents Quick Start Gradle Maven Documentat

Philipp Jahoda 36k Jan 5, 2023
Easy to use and highly customizable pie charts library for iOS

PieCharts Easy to use and highly customizable pie charts library for iOS Swift 4.2, iOS 8+ Video Features: Customizable slices Add overlays using simp

null 503 Dec 6, 2022
Core Charts | Basic Scrollable Chart Library for iOS

Core Charts | Basic Chart Library for iOS HCoreBarChart VCoreBarChart Requirements Installation Usage Appearance Customization Getting Started You nee

Çağrı ÇOLAK 71 Nov 17, 2022
FLCharts: Easy to use and highly customizable charts library for iOS

FLCharts Requirements Xcode 11 / Swift 5 iOS >= 11.0 Installation FLCharts is av

Francesco Leoni 250 Dec 26, 2022
Easy to use and highly customizable pie charts library for iOS

PieCharts Easy to use and highly customizable pie charts library for iOS Swift 4.2, iOS 8+ Video Features: Customizable slices Add overlays using simp

null 503 Dec 6, 2022
🎉 SwiftUI stock charts for iOS

SwiftUI Stock Charts Display interactive stock charts easily ?? Instalation In Xcode go to File -> Swift packages -> Add package dependency Copy and p

Dennis Concepción Martín 94 Dec 26, 2022
🎉 SwiftUI stock charts for iOS

?? SwiftUI stock charts for iOS

Dennis Concepción Martín 94 Dec 26, 2022
SwiftUI Charts with custom styles

SwiftUI Charts Build custom charts with SwiftUI Styles Line Chart(data: [0.1, 0.3, 0.2, 0.5, 0.4, 0.9, 0.1]) .chartStyle( LineChartStyle(.

SpaceNation 609 Jan 6, 2023
Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.

One more heads up: As Swift evolves, if you are not using the latest Swift compiler, you shouldn't check out the master branch. Instead, you should go to the release page and pick up whatever suits you.

Daniel Cohen Gindi 26.3k Jan 3, 2023
An iOS wrapper for ChartJS. Easily build animated charts by leveraging the power of native Obj-C code.

TWRCharts TWRCharts An Obj-C wrapper for ChartJS. Easily build animated charts by leveraging the power of native code. TWRCharts is yet another charti

Michelangelo Chasseur 363 Nov 28, 2022
Light weight charts view generater for iOS. Written in Swift.

# ###Light weight charts view generater for iOS. Written in Swift. Requirements iOS 8.0+ XCode 7.3+ Installation CocoaPods $ pod init specify it in yo

Recruit Holdings. Media Technology Lab 982 Nov 16, 2022
Health Sample app using Swift, RxSwift, Anchorage, Charts

HealthSample First run pod install, then build the project and run in your devices or simulators. This project has used RIBs, Swift, RxSwift, Anchorag

null 4 Feb 11, 2022
Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.

Version 4.0.0, synced to MPAndroidChart #f6a398b Just a heads up: Charts 3.0 has some breaking changes. Please read the release/migration notes. Anoth

Daniel Cohen Gindi 26.3k Jan 8, 2023
Aplikasi iOS kasus Covid-19 di U.S dengan Storyboard, Framework Charts dari danielgindi, dan API dari covidtracking.com

Aplikasi iOS kasus Covid-19 di U.S dengan Storyboard, Framework Charts dari danielgindi, dan API dari covidtracking.com

DK 7 Aug 1, 2022