SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
Yesterday we announced that SciChart iOS/Android v2 was officially in BETA. This latest release of SciChart iOS/Android also includes the eagerly awaited Xamarin support!
In this video and article we’re going to show you how to get started with SciChart for Xamarin. Xamarin development is a little different from plain WPF development so there are a few things you need to know. However, once you have worked through this tutorial you’ll be able to create simple apps with SciChart for Xamarin!
Note: If you’ve already setup a development environment for xamarin, feel free to skip this part! Instead, scroll down to ‘Downloading the SciChart Xamarin Examples’
To develop with Xamarin you will need Visual Studio 2015, or 2017. For the purpose of this article we’re going to use Visual Studio 2015. If you haven’t installed Visual Studio yet, please do so by downloading it and following instructions from here.
Let’s start by setting up a development environment for Xamarin. There are instructions on how to setup a dev environment over at developer.xamarin.com.
- Right-click the Windows Start button and select Programs and Features.
- Right-click Microsoft Visual Studio and click Change.
- When the Visual Studio Installer dialog appears, click the Modify button.
- In the Features tab, scroll down to Cross Platform Mobile Development. Click the checkbox next to C#/.NET (Xamarin):
If you want to develop for Android you will also need to install the JDK, The Android SDK and the Android NDK. During installation, the Visual Studio installer places these tools in their default locations and configures the development environment with the appropriate path configuration. Instructions on how to configure the location of the Android SDK, and install Android emulators can be found at the Xamarin Visual Studio 2015 Setup guide.
If you want to develop for iOS, you will need an OSX machine. This is a hard limitation for iOS development. The actual compilation is done on a Mac, even if development is done on Windows. This can be a Mac build server shared between many developers. it just needs to be configured correctly.
The Mac build server should have Visual Studio for Mac installed as well as XCode. This will download the iOS, Android SDKs on your mac device. Once this is done you can connect your Visual Studio 2015 instance to the Mac build server.
For iOS Development only: after setting up your Mac build server, go to Visual Studio -> iOS -> Xamarin Mac Agent. Follow the steps from the Xamarin Developer Guide – Connecting to the Mac to ensure your VS2015 instance is correctly setup for iOS development.
OK if you’ve done all that, now it’s time to get to the good stuff! The SciChart Xamarin Examples are hosted on Github at https://github.com/ABTSoftware/SciChart.Xamarin.Examples. Let’s have a look at that page.
You can fetch the SciChart Xamarin examples code from Github by either:
Don’t let lack of Git or SVN stop you here, just download and go if you want!
After downloading the source for the SciChart Xamarin Examples, let’s go ahead and build the examples. You’ll need to open the Solution in \src\Xamarin.Examples.Deploy.sln in Visual Studio
SciChart.Xamarin assemblies are included in the SciChart NuGet feed. This is a private feed which you will need to add to Visual Studio. Instructions on how to setup the SciChart NuGet feeds can be found here.
To setup the NuGet feed:
If you want to build Xamarin.iOS, you will need to connect to a Xamarin Mac Development Server. Go to Tools -> iOS -> Xamarin Mac Agent and connect to a Mac. To do this I am using a local Mac, but you can use any Mac you have access to in the cloud. For instructions on how to setup the Xamarin Mac Agent please see developer.xamarin.com.
Note: If you don’t want to build for iOS, simply right-click and unload the project Xamarin.Examples.Demo.iOS.
That should be everything. All you need to do now is select a target and run! Spend a moment to play around with our examples. We’ve created about 20 of them and are planning to create more in the very near future.
Select Xamarin.Examples.Demo.Droid as the startup project. Connect a physical Android Device, or choose an Android simulator, and run!
Select Xamarin.Examples.Demo.iOS as the startup project. Connect a physical iOS Device, or choose an iOS Simulator, and run!
We’ve taken the time to create approximately 20 examples for our high performance realtime charts in Xamarin Android and Xamarin iOS. These include:
The examples suite contains many more examples so it’s worth downloading them to run the examples and see what SciChart can do!
If you’ve successfully run the SciChart Xamarin Android/iOS demos and want to learn a bit more about SciChart, including how to create an app from scratch with SciChart, take a look at our tutorials which are now online.
These are found here:
As always, your feedback is greatly appreciated. If there’s something you want to know or if you have any feedback for us. We would be glad to hear it!