Sonntag, 19. Juli 2015

Multiline chart, now with less code

I started adding some convenience classes to SwiftCharts to create popular charts quickly.

This is how now a multiline chart is created:

let chart = LineChart(
    frame: CGRectMake(0, 70, 300, 500),
    chartConfig: ChartConfig(
        xAxisConfig: ChartAxisConfig(from: 2, to: 14, by: 2),
        yAxisConfig: ChartAxisConfig(from: 0, to: 14, by: 2)
    ),
    xTitle: "X axis",
    yTitle: "Y axis",
    lines: [
        (chartPoints: [(2.0, 10.6), (4.2, 5.1), (7.3, 3.0), (8.1, 5.5), (14.0, 8.0)], color: UIColor.redColor()),
        (chartPoints: [(2.0, 2.6), (4.2, 4.1), (7.3, 1.0), (8.1, 11.5), (14.0, 3.0)], color: UIColor.blueColor())
    ]
)
self.view.addSubview(chart.view)

Of course the "low level" api and examples continue to be available, and should be used when the convenience charts don't provide the required level of customization.

More will follow!

Montag, 13. Juli 2015