Hi,
I don't know why but setting the ToolTip enable for my column data is causing the entire chart to disappear. Here's my code to load the Chart Columns:
In my Fragment:
var chartService = Mvx.Resolve<IChartService> ();
frame_basket = view.FindViewById<FrameLayout> (Resource.Id.frame_basket);
frame_basket.AddView(chartService.GetBasketSizeColumnChart(this.Activity, IndicatorsVm.BarsData.ElementAt(0)));
The GetBasketSizeColumnChart function is defined:
#region GetBasketSizeColumnChart
public View GetBasketSizeColumnChart (Context context, CurrentMonthIndicator indicator)
{
SfChart chart = new SfChart(context);
chart.SetBackgroundColor(Color.White);
chart.Legend.Visibility = Visibility.Visible;
chart.Legend.ToggleSeriesVisibility = true;
chart.Legend.DockPosition = ChartDock.Bottom;
CategoryAxis categoryaxis = new CategoryAxis();
categoryaxis.LabelPlacement = LabelPlacement.BetweenTicks;
categoryaxis.Title.Text = indicator.Name;
chart.PrimaryAxis = categoryaxis;
// Calculate the numerical axis
var max = System.Math.Max(indicator.RealValue, indicator.TargetValue);
NumericalAxis numericalaxis = this.GetNumericalAxis (max);
chart.SecondaryAxis = numericalaxis;
// Real data
ColumnSeries columnSeries1 = new ColumnSeries();
columnSeries1.Label = context.Resources.GetString(Resource.String.sales_indicators_real);
columnSeries1.LegendIcon = ChartLegendIcon.Rectangle;
var dataReal = new ObservableArrayList();
dataReal.Add(new ChartDataPoint(context.Resources.GetString(Resource.String.sales_indicators_real), (double)indicator.RealValue));
columnSeries1.DataSource = dataReal;
// Target Data
ColumnSeries columnSeries2 = new ColumnSeries();
columnSeries2.Label = context.Resources.GetString(Resource.String.sales_indicators_target);
columnSeries2.LegendIcon = ChartLegendIcon.Rectangle;
var dataTarget = new ObservableArrayList();
dataTarget.Add(new ChartDataPoint(context.Resources.GetString(Resource.String.sales_indicators_target), (double)indicator.TargetValue));
columnSeries2.DataSource = dataTarget;
chart.Series.Add(columnSeries1);
chart.Series.Add(columnSeries2);
columnSeries1.TooltipEnabled = true;
columnSeries2.TooltipEnabled = true;
return chart;
}
#endregion
Once the animation of the tooltip finished the chart is reloaded somehow with no data.
Am I doing something wrong?
I have attached couple of images with the results.
Attachment:
Archive_33fda386.zip