Thread ID:
|
Created:
|
Updated:
|
Platform:
|
Replies:
|
126052
|
Sep 20,2016 03:59 PM
|
|
Xamarin.Forms
|
0
|
Tincani
Asked on September 20, 2016 03:59 PM
Hello,
I attached two files.
- One contains the result I want to my android SfChart
- The second is the actual rendering
How to modify the current code to have this rendering ?
I use the following code :
SfChart chart = new SfChart(Activity);
chart.VerticalScrollBarEnabled = false;
chart.HorizontalScrollBarEnabled = false;
CategoryAxis primaryAxis = new CategoryAxis();
primaryAxis.Visibility = Visibility.Gone;
primaryAxis.StripLines.Clear();
primaryAxis.ShowMajorGridLines = false;
chart.PrimaryAxis = primaryAxis;
NumericalAxis secondaryAxis = new NumericalAxis();
secondaryAxis.Visibility = Visibility.Gone;
secondaryAxis.StripLines.Clear();
secondaryAxis.ShowMajorGridLines = false;
chart.SecondaryAxis = secondaryAxis;
List<Integer> colors = new List<Integer>();
ObservableArrayList data = new ObservableArrayList();
foreach (ParticipantViewModel participantViewModel in this._participants.Where(x => x.Difference != 0))
{
data.Add(new ChartDataPoint(participantViewModel.Name, participantViewModel.Difference));
if (participantViewModel.Difference > 0)
colors.Add(new Integer(new Color(Constants.ColorPositiveR,
Constants.ColorPositiveG, Constants.ColorPositiveB)));
else
colors.Add(new Integer(new Color(Constants.ColorNegativeR,
Constants.ColorNegativeG, Constants.ColorNegativeB)));
}
ColumnSeries series1 = new ColumnSeries()
{
DataSource = data,
TooltipEnabled = true,
AnimationEnabled = true,
AnimationDuration = 0.2,
Label = "Income"
};
series1.ColorModel.ColorPalette = ChartColorPalette.Custom;
series1.ColorModel.CustomColors = colors;
series1.DataMarker.MarkerType = DataMarkerType.Ellipse;
series1.DataMarker.ShowMarker = true;
series1.DataMarker.ShowLabel = true;
chart.Series.Add(series1);
Thanks in advance
Geoffrey
Attachment:
Pictures_33e0d2b1.7z