Hi
Am using ZedGraphweb control to show pie chart. I have to display the percentage in each block not in legend. In legend i have to show the text labels. and i have to show percentage in graph itself. Can you please help me.
Thanks in Advance
My code look like this
private void InitializeComponent()
{
this.ZedGraphWeb1.RenderGraph += new ZedGraph.Web.ZedGraphWebControlEventHandler(this.OnRenderGraph1);
}
private void OnRenderGraph1(ZedGraph.Web.ZedGraphWeb z1, System.Drawing.Graphics g, ZedGraph.MasterPane masterPane)
{
GraphPane myPane = masterPane[0];
string[] labels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
double[] x4 = { 80, 50, 20, 20, 90, 80, 30, 50, 60, 30, 80, 70 };
myPane.Fill = new Fill(Color.White, Color.Goldenrod, 45.0f);
myPane.Chart.Fill.Type = FillType.None;
myPane.Legend.Position = LegendPos.Float;
myPane.Legend.Location = new Location(0.95f, 0.15f, CoordType.PaneFraction, AlignH.Right, AlignV.Top);
myPane.Legend.FontSpec.Size = 10f;
myPane.Legend.IsHStack = false;
myPane.YAxis.MinorTic.IsOpposite = false;
myPane.XAxis.MajorGrid.DashOff = 0;
myPane.XAxis.MajorTic.Color = Color.WhiteSmoke;
myPane.YAxis.MajorGrid.DashOff = 0;
myPane.YAxis.MajorTic.Color = Color.WhiteSmoke;
myPane.XAxis.MajorGrid.Color = Color.WhiteSmoke;
myPane.YAxis.MajorGrid.Color = Color.WhiteSmoke;
myPane.XAxis.Scale.TextLabels = labels;
myPane.Legend.Position = LegendPos.InsideTopRight;
PieItem segment2 = myPane.AddPieSlice(x4[1], Color.Purple, Color.White, 45f, 0, "Feb");
PieItem segment3 = myPane.AddPieSlice(x4[2], Color.LimeGreen, Color.White, 45f, 0, "Mar");
PieItem segment4 = myPane.AddPieSlice(x4[3], Color.SandyBrown, Color.White, 45f, 0, "Apr");
PieItem segment5 = myPane.AddPieSlice(x4[4], Color.Red, Color.White, 45f, 0, "May");
PieItem segment6 = myPane.AddPieSlice(x4[5], Color.Blue, Color.White, 45f, 0, "Jun");
PieItem segment7 = myPane.AddPieSlice(x4[6], Color.Green, Color.White, 45f, 0, "Jul");
PieItem segment8 = myPane.AddPieSlice(x4[7], Color.Yellow, Color.White, 45f, 0, "Aug");
PieItem segment9 = myPane.AddPieSlice(x4[8], Color.YellowGreen, Color.White, 45f, 0, "Sep");
PieItem segment10 = myPane.AddPieSlice(x4[9], Color.AliceBlue, Color.White, 45f, 0, "Oct");
PieItem segment11 = myPane.AddPieSlice(x4[10], Color.AntiqueWhite, Color.White, 45f, 0, "Nov");
PieItem segment12 = myPane.AddPieSlice(x4[11], Color.Aqua, Color.White, 45f, 0, "Dec");
}