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;
}
pie charts display issue
Re: pie charts display issue
Hello Hezi,
in order to set alignment for the Header you should use the chart.Header.Alignment property. I changed this property in your code, also set the Legent visible to a false and reduce the font size, to be able to show all the header text into the Charts, here is the part of code I used :
I've also attached an image to a this post with the result.
in order to set alignment for the Header you should use the chart.Header.Alignment property. I changed this property in your code, also set the Legent visible to a false and reduce the font size, to be able to show all the header text into the Charts, here is the part of code I used :
Code: Select all
private void AddChartView(string headerTitle, RectangleF recFrame, float value1, float value2, string title1, string title2)
{
TChart chart = new TChart();
chart.Frame = recFrame;
chart.Header.Alignment = CTTextAlignment.Center;
chart.Header.Text = headerTitle;
chart.Header.Font.Size = 13;
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;
chart.Legend.Visible = false;
}
- Attachments
-
- Captura de pantalla 2014-01-20 a la(s) 16.14.49.png (63.94 KiB) Viewed 4760 times
Pep Jorge
http://support.steema.com
http://support.steema.com