饼图标签定位 [英] Pie Chart Label Positioning

查看:88
本文介绍了饼图标签定位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用< asp:Chart控件来显示饼图。一切正常,但我有标签问题。我的图表和我的标签之间有一英寸,我不明白。这是我的代码

C#

I'm working with the <asp:Chart control to display a Pie chart. Everything works fine but Im having issues with the labels. There is about an inch between my chart and my label and I dont understand. Here's my code

C#

 Color[] customPalette = new Color[8];
            customPalette[0] = ColorTranslator.FromHtml("#73C167");
            customPalette[1] = ColorTranslator.FromHtml("#FFD24F");
            customPalette[2] = ColorTranslator.FromHtml("#F58426");
            customPalette[3] = ColorTranslator.FromHtml("#EF3E42");
            customPalette[4] = ColorTranslator.FromHtml("#D38CBD");
            customPalette[5] = ColorTranslator.FromHtml("#8177B7");
            customPalette[6] = ColorTranslator.FromHtml("#00AFDB");
            customPalette[7] = ColorTranslator.FromHtml("#3342B4");

            Chart1.PaletteCustomColors = customPalette;

            // Populate series data
            double[] yValues = { 65.62, 75.54, 60.45, 55.73, 70.42 };
            string[] xValues = { "France", "Canada", "UK", "USA", "Italy" };
            Chart1.Series["Default"].Points.DataBindXY(xValues, yValues);

            Chart1.Series["Default"]["PieLabelStyle"] = "Outside";
            Chart1.Series["Default"]["PieLineColor"] = "Transparent";
            Chart1.Series["Default"]["3DLabelLineSize"] = "30";

            

            Chart1.Series["Default"]["LabelsHorizontalLineSize"] = "30";

            // Set chart type and title
            Chart1.Series["Default"].ChartType = SeriesChartType.Pie;
            //Chart1.Titles[0].Text = "My Pie Chart";

            // Enable 3D
            Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;




ASPX




ASPX

<asp:Chart ID="Chart1" runat="server" Palette="None" Width="512px" BackSecondaryColor="White"
        ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)">
        <Legends>
            <asp:Legend BackColor="Transparent" Alignment="Center" Docking="Bottom" Font="Trebuchet MS, 8.25pt, style=Bold"
                IsTextAutoFit="False" Name="Default" LegendStyle="Row" IsDockedInsideChartArea="true">
            </asp:Legend>
        </Legends>
        <Series>
            <asp:Series Name="Default" ChartType="Pie" ShadowColor="#CCCCCC" Color="#73C167">
            </asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1" BackSecondaryColor="Transparent" BackColor="Transparent"
                ShadowColor="Transparent" BorderWidth="2" BorderColor="#CC0066" ShadowOffset="-5"
                IsSameFontSizeForAllAxes="False">
                <Area3DStyle Rotation="0" Inclination="70" PointDepth="90" LightStyle="Simplistic" />
                <AxisY>
                    <LabelStyle Font="Arial, 8pt" ForeColor="#828282" />
                </AxisY>
                <AxisX>
                    <LabelStyle Font="Arial, 8pt" ForeColor="#828282" />
                </AxisX>
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart>

推荐答案

您好Sykespro,我不是这些新图表的专家(绝不是),但你玩过"对齐 = " ;中心" 停靠 = " Bottom" ; " ??可能对齐应该是"顶部"?
Hi Sykespro,  I am no expert at these new charts (by no means), but have you played with "Alignment="Center" Docking="Bottom"" ??  Maybe the alignment should be "Top"?


这篇关于饼图标签定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆