pie charts display issue
Posted: Sun Jan 19, 2014 1:16 pm
Hi,
I am using the Charts evaluation version for Xamarin .net and
I need to display 4 pies: two in each row and it’s not display as expected.
I need your help please.
The pies not the same size and the title not Align to the center in the 4th title missing the word ‘non’ on the start of the sentence,
Its look like the label width make the difference between the pies.
Please advise.
The code example :
public StatisticsScreen() //c’tor
{
Title = "Statistics";
AddChart1();
AddChart2();
AddChart3();
AddChart4();
}
private void AddChart1()
{
AddChartView("Card Statistics", new RectangleF(10, 10, View.Frame.Width / 2 - 40, View.Frame.Height / 2 - 60),
(float)40, (float)60, "% Routine Cards", "% Non Routine Cards");
}
private void AddChart2()
{
AddChartView("Labor Statistics", new RectangleF(View.Frame.Width / 2 , 10, View.Frame.Width / 2 - 40, View.Frame.Height / 2 - 60),
(float)77, (float)23, "% Actual Hours", "% Plan Hours");
}
private void AddChart3()
{
AddChartView("Routine Card Statistics", new RectangleF(10, View.Frame.Height / 2 - 40, View.Frame.Width / 2 - 40, View.Frame.Height / 2 - 60),
(float)50, (float)50, "% Closed Routine Cards", "% Open Routine Cards");
}
private void AddChart4()
{
AddChartView("Non Routine Card Statistics", new RectangleF(View.Frame.Width / 2 , View.Frame.Height / 2 - 40, View.Frame.Width / 2 - 40, View.Frame.Height / 2 - 60),
(float)33, (float)67, "% Closed Non Routine Cards", "% Open Non Routine Cards");
}
private void AddChartView(string headerTitle, RectangleF recFrame, float value1, float value2, string title1, string title2)
{
TChart chart = new TChart();
chart.Frame = recFrame;
chart.Header.TextAlign = CTTextAlignment.Center;
chart.Header.Text = headerTitle;
chart.Header.Font.Size = 15;
chart.Header.Font.Color = UIColor.Black.CGColor;
View.AddSubview(chart);
Pie pieSeries = new Pie();
chart.Series.Add(pieSeries);
pieSeries.Add(value1,title1,UIColor.FromRGB(104, 159, 255).CGColor);
pieSeries.Add(value2,title2,UIColor.FromRGB(181, 208, 255).CGColor);
pieSeries.Circled = true;
pieSeries.Marks.Visible = false;
}
I am using the Charts evaluation version for Xamarin .net and
I need to display 4 pies: two in each row and it’s not display as expected.
I need your help please.
The pies not the same size and the title not Align to the center in the 4th title missing the word ‘non’ on the start of the sentence,
Its look like the label width make the difference between the pies.
Please advise.
The code example :
public StatisticsScreen() //c’tor
{
Title = "Statistics";
AddChart1();
AddChart2();
AddChart3();
AddChart4();
}
private void AddChart1()
{
AddChartView("Card Statistics", new RectangleF(10, 10, View.Frame.Width / 2 - 40, View.Frame.Height / 2 - 60),
(float)40, (float)60, "% Routine Cards", "% Non Routine Cards");
}
private void AddChart2()
{
AddChartView("Labor Statistics", new RectangleF(View.Frame.Width / 2 , 10, View.Frame.Width / 2 - 40, View.Frame.Height / 2 - 60),
(float)77, (float)23, "% Actual Hours", "% Plan Hours");
}
private void AddChart3()
{
AddChartView("Routine Card Statistics", new RectangleF(10, View.Frame.Height / 2 - 40, View.Frame.Width / 2 - 40, View.Frame.Height / 2 - 60),
(float)50, (float)50, "% Closed Routine Cards", "% Open Routine Cards");
}
private void AddChart4()
{
AddChartView("Non Routine Card Statistics", new RectangleF(View.Frame.Width / 2 , View.Frame.Height / 2 - 40, View.Frame.Width / 2 - 40, View.Frame.Height / 2 - 60),
(float)33, (float)67, "% Closed Non Routine Cards", "% Open Non Routine Cards");
}
private void AddChartView(string headerTitle, RectangleF recFrame, float value1, float value2, string title1, string title2)
{
TChart chart = new TChart();
chart.Frame = recFrame;
chart.Header.TextAlign = CTTextAlignment.Center;
chart.Header.Text = headerTitle;
chart.Header.Font.Size = 15;
chart.Header.Font.Color = UIColor.Black.CGColor;
View.AddSubview(chart);
Pie pieSeries = new Pie();
chart.Series.Add(pieSeries);
pieSeries.Add(value1,title1,UIColor.FromRGB(104, 159, 255).CGColor);
pieSeries.Add(value2,title2,UIColor.FromRGB(181, 208, 255).CGColor);
pieSeries.Circled = true;
pieSeries.Marks.Visible = false;
}