Question : ASP.NET ChartControl

Hello,

I have the following ChartControl Markup and Code below and I'm in the need of some help with removing values inside of the PieChart/Doughnut Chart. In other words I have a legend that displays the value but the ChartControl has the labels inside each color which i want to remove since i have a legend showing the user what each color is associated to its value.

        <asp:Chart ID="chtCountHearAboutValues" runat="server"
            OnLoad="chtCountHearAboutValues_Load" Palette="None" Height="461px"
            Width="715px"
            PaletteCustomColors="Red; 255, 128, 0; Yellow; Lime; Cyan; Blue; Fuchsia"
            BackGradientStyle="DiagonalRight" BackHatchStyle="DashedHorizontal"
            BackImageTransparentColor="224, 224, 224">
            <Series>
                <asp:Series Name="Series1" YValuesPerPoint="4" ChartType="Doughnut"
                    Font="Microsoft Sans Serif, 8pt" Legend="Legend1">
                </asp:Series>
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1" Area3DStyle-Enable3D="true" Area3DStyle-LightStyle="Simplistic">
                    <Area3DStyle Enable3D="True" IsClustered="True"></Area3DStyle>
                </asp:ChartArea>
            </ChartAreas>
            <Legends>
                <asp:Legend Name="Legend1" BackGradientStyle="None" BackHatchStyle="None" Docking="Bottom" Title="How did you hear about PA Cyber?" TitleSeparator="None" ForeColor="#666666" TitleFont="Microsoft Sans Serif, 10pt, style=Bold" Font="Microsoft Sans Serif, 10pt">
                </asp:Legend>
            </Legends>
        </asp:Chart>


    protected void chtCountHearAboutValues_Load(object sender, EventArgs e)
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Admissions"].ConnectionString);

        SqlCommand cmd = new SqlCommand();
        cmd.CommandText = "Admissions_ChartReportCountHearAboutValues";
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Connection = conn;

        try
        {
            conn.Open();

            SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            chtCountHearAboutValues.Series["Series1"].Points.DataBindXY(rdr, "hear_description", rdr, "total");

            // Create a new legend called "Legend1".
            chtCountHearAboutValues.Legends.Add(new Legend("Legend1"));
            // Set Docking of the Legend chart to the Default Chart Area.
            chtCountHearAboutValues.Legends["Legend1"].DockedToChartArea = "Default";
            // Assign the legend to Series1.
            chtCountHearAboutValues.Series["Series1"].Legend = "Legend1";
            chtCountHearAboutValues.Series["Series1"].IsVisibleInLegend = true;
        }

        catch (Exception ex)
        {
            ex.Message.ToString();
        }

        finally
        {
            conn.Close();
        }
    }

Answer : ASP.NET ChartControl

I tried to find a solution for you, and if you are still having a problem, I don't believe that I can help you.
Random Solutions  
 
programming4us programming4us