We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

LineSeries with multiple DataMarker color

Hi,

Sorry if the question seems trivial, this is the first day that I'm using your product and I'm evaluating it before proceeding with the purchase.

I need a LineSeries with different colors for the markers (is a temperature graph).

Below a certain threshold i should have a color (let say green), over this threshold and below another i should have another color ((let say orange) and over this threshold I should have another color (let say red)

Is it possible to obtain this result with graph?


Another question: is it possible to have an horizontal line which represents the average of the temperatures?

Thank you!

Marco

3 Replies

ME Manivannan Elangovan Syncfusion Team October 22, 2015 10:48 AM UTC

Hi Marco,

Thanks for using Syncfusion products.

Query1:I need a LineSeries with different colors for the markers

We are able to achieve your requirement by using ValueToPoint method in the chart and AbsoluteLayout in the Xamarin forms. We have prepared a workaround sample based on your requirement..

Query2:Is it possible to have an horizontal line which represents the average of the temperatures?

We are able to achieve your above requirement by using StripLines. Please find the following code example which shows how to define the striplines in axis.

Code Example:

NumericalAxis numaxis = new NumericalAxis ();
chart.SecondaryAxis = numaxis;
NumericalStripLine strip1 = new NumericalStripLine ();
strip1.Start = 22;
strip1.Width = -7;
strip1.FillColor = Color.Green;
strip1.IsPixelWidth = true;
strip1.Text = "Low Temperature";
numaxis.StripLines.Add (strip1);

Sample: DataMarker

Note: We have used BoxView instead of datamarker symbols. Write Custom renderer for the different datamarker symbols.

Regards,
Manivannan.E
 


MA Marco October 22, 2015 11:11 AM UTC

Hi,

thank you for your reply and your example.

The NumericalStripLine works very well, on this just one question for curiosity: why the row "strip1.Width = -7" ?
About the second point, my graph has EnablePanning set to true, so the BoxView method doesn't work.
Do you have any other workaround?

Thank you!

Marco


ME Manivannan Elangovan Syncfusion Team October 23, 2015 01:07 PM UTC

Hi Marco,

Query1: why the row "strip1.Width = -7" ?

StripLines are rendered based on Start and Width property values. If the value of width is positive means striplines render upwards from the start property value, if negative means render downwards from the start value.

Query2: my graph has EnablePanning set to true, so the BoxView method doesn't work.

We have modified the workaround sample based on your requirement. Please download the sample from the following location.

Sample: Datamarker

Regards,
Manivannan.E

Loader.
Live Chat Icon For mobile
Up arrow icon