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);
Attachment:
Pictures_95b48d51.7z