Skip to content

Instantly share code, notes, and snippets.

@Divya1425
Last active September 28, 2017 09:44
Show Gist options
  • Save Divya1425/6d8e0dec06b787f32c23ad432c49ce8d to your computer and use it in GitHub Desktop.
Save Divya1425/6d8e0dec06b787f32c23ad432c49ce8d to your computer and use it in GitHub Desktop.
layout title description platform control documentation
post
Customize data points
How to customize data points in Essential Xamarin.Forms Sparkline
xamarin
Sparkline
ug

Customize data points

Color of the first, last, high, low and negative data points can be customized using the following properties.

N> NegativePointsColor is applicable for SfColumnSparkline and SfWinLossSparkline alone.

Code snippet to customize the markers

{% tabs %}

{% highlight xaml %}

<sparkline:SfLineSparkline ItemsSource = "{Binding Data}" YBindingPath = "Performance" FirstPointColor="Green" LastPointColor="Blue" HighPointColor="Purple" LowPointColor="Red">
sparkline:SfLineSparkline.Marker <sparkline:MarkerBase IsVisible="True" Width= "15" Height= "15"/> </sparkline:SfLineSparkline.Marker> </sparkline:SfLineSparkline>

{% endhighlight %}

{% highlight c# %}

SfLineSparkline lineSparkline = new SfLineSparkline() { YBindingPath = "Performance", ItemsSource = viewModel.Data, Marker = new MarkerBase() { IsVisible = true, Width = 15, Height = 15 },

FirstPointColor = Color.Green,
LastPointColor = Color.Blue,
HighPointColor = Color.Purple,
LowPointColor = Color.Red

};

{% endhighlight %}

{% endtabs %}

Code snippet to customize the segments

{% tabs %}

{% highlight xaml %}

<sparkline:SfColumnSparkline ItemsSource="{Binding Data}" YBindingPath="Performance" FirstPointColor="Green" LastPointColor="Purple" HighPointColor="Maroon" LowPointColor="Blue" NegativePointsColor="Red">

</sparkline:SfColumnSparkline>

{% endhighlight %}

{% highlight c# %}

SfColumnSparkline columnSparkline = new SfColumnSparkline() { YBindingPath = "Performance", ItemsSource = viewModel.Data, FirstPointColor = Color.Green, LastPointColor = Color.Purple, HighPointColor = Color.Maroon, LowPointColor = Color.Blue, NegativePointsColor = Color.Red };

{% endhighlight %}

{% endtabs %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment