Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.26 KB

README.md

File metadata and controls

50 lines (36 loc) · 1.26 KB

XCharts.iOS

This is the lightweight C# chart rendering library for Xamarin iOS.

At this moment there are two views of charts:

  • LineChartView - simple enough, used to display line charts. Allows you flexibly customize its style.
  • ChartView - allows you to display any type of charts by implementing custom render.

Samples

Line chart Line chart


Quick start

  1. Install nuget package XCharts.iOS
  2. Add ChartView to View. You can do it in xib or by code like:
var lineChart = new LineChartView();

lineChart.TranslatesAutoresizingMaskIntoConstraints = false;

this.View.AddSubview(lineChart);

NSLayoutConstraint.ActivateConstraints(new NSLayoutConstraint[]
{
   lineChart.TopAnchor.ConstraintEqualTo(View.TopAnchor),
   lineChart.BottomAnchor.ConstraintEqualTo(View.BottomAnchor),
   lineChart.LeftAnchor.ConstraintEqualTo(View.LeftAnchor),
   lineChart.RightAnchor.ConstraintEqualTo(View.RightAnchor)
});
  1. Set chart datasource:
var points = new List<double>();
var r = new Random();
for (int i = 0; i < 1000; i++)
{
   points.Add(r.Next(0, 10000));
}

lineChart.DataSource = new IndexValueDataSource(points);