Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4625610
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:17:52+00:00 2026-05-22T03:17:52+00:00

The particular problem is one that have been asked before. I’ve got an asp:chart

  • 0

The particular problem is one that have been asked before. I’ve got an asp:chart control and it’s not showing all my labels on the X axis. Same question as:
Why do labels disappear in ASP.NET charting?

However the answer (interval=1 on X axis) does nothing on my control. And furthermore, I’m wondering if I’ve got some wrong settings, because a lot of things does nothing when I try to change them, for example LabelAutoFitStyle setting doesn’t effect anything on my chart.

Here is my code:

<asp:Chart ID="SalesChart" Width="500" Height="400" ImageStorageMode="UseHttpHandler" EnableViewState="False" runat="server" ImageType="Png">
        <Series>
            <asp:Series ChartType="Column" Name="StatsSeries" XAxisType="Secondary" ToolTip="#VALX: #VALY{C0}" label="#VALY{C0}" LabelBorderColor="Gray" LabelBackColor="#FFF6AA">
                <Points>
                </Points>
            </asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Area3DStyle-Enable3D="true" Name="StatsChartArea" Area3DStyle-PointGapDepth="0" Area3DStyle-Rotation="20" Area3DStyle-PointDepth="60" Area3DStyle-Inclination="20">
                <AxisX LabelAutoFitMinFontSize="10" Interval="1">
                    <MajorGrid Interval="1" />
                    <MinorGrid />
                    <LabelStyle Interval="1" />
                </AxisX>
                <AxisY>
                    <LabelStyle Format='{C0}' />
                    <MinorGrid Enabled="True" LineColor="Gray" />
                </AxisY>
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart>

code behind (I’ve hidden a lot of code here that is not relevant):

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            // Here I get chart data


            //Set everything up
            if (statsDataTable.Rows.Count > 0)
            {
                SetChartData(statsDataTable);
                SetChartGridResolution();
                SetChartBarColors();
            }
        }
    }


    private void SetChartData(DataTable statsDataTable)
    {
        ArrayList xValues = new ArrayList();
        ArrayList yValues = new ArrayList();

        // I populate the lists with values, and then bind it below


        SalesChart.Series[0].Points.DataBindXY(xValues, yValues);
    }

    /// <summary>
    /// Set the intervals on the grid, based on the highest value.
    /// </summary>
    private void SetChartGridResolution()
    {
        if (SalesChart.Series[0].Points.FindMaxByValue().YValues[0] > 2000000)
        {
            SalesChart.ChartAreas[0].AxisY.LabelStyle.Interval = 1000000;
            SalesChart.ChartAreas[0].AxisY.MajorGrid.Interval = 1000000;
            SalesChart.ChartAreas[0].AxisY.MajorTickMark.Interval = 1000000;
            SalesChart.ChartAreas[0].AxisY.MinorGrid.Interval = 500000;

        }
        else if (SalesChart.Series[0].Points.FindMaxByValue().YValues[0] > 1000000)
        {
            SalesChart.ChartAreas[0].AxisY.LabelStyle.Interval = 200000;
            SalesChart.ChartAreas[0].AxisY.MajorGrid.Interval = 200000;
            SalesChart.ChartAreas[0].AxisY.MajorTickMark.Interval = 200000;
            SalesChart.ChartAreas[0].AxisY.MinorGrid.Interval = 100000;
        }
        else
        {
            SalesChart.ChartAreas[0].AxisY.LabelStyle.Interval = 100000;
            SalesChart.ChartAreas[0].AxisY.MajorGrid.Interval = 100000;
            SalesChart.ChartAreas[0].AxisY.MajorTickMark.Interval = 100000;
            SalesChart.ChartAreas[0].AxisY.MinorGrid.Interval = 50000;
        }
    }

    private void SetChartBarColors()
    {
        System.Drawing.Color color1 = System.Drawing.ColorTranslator.FromHtml("#007dc3");
        System.Drawing.Color color2 = System.Drawing.ColorTranslator.FromHtml("#539dc8");

        for (int i = 0; i < SalesChart.Series[0].Points.Count; i++)
        {
            if (i % 2 == 0)
                SalesChart.Series[0].Points[i].Color = color1;
            else
                SalesChart.Series[0].Points[i].Color = color2;
        }
    }

I’d be great if you could give me a clue!

Regards Jacob

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:17:53+00:00Added an answer on May 22, 2026 at 3:17 am

    Ok, I solved it! This problem has cost me several hours, trying to solve various problems. I hope someone can be spared that by reading this.

    It was all because of XAxisType=”Secondary”, when this is selected (to use the upper x-line instead of the lower) all configuration on the x-axis must be set on instead of . This was causing a lot of things to “not work” for me…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, apologies if this question has been asked before but I couldn't find
I'm not even quite sure where to start explaining this problem. I've been working
I have a production performance issue that I'm stumped on. I'm hoping that someone
I've been upgrading some Silverlight 3 apps to Silverlight 4 in Visual Studio 2010.
I'm pretty new to Android app development, and I've been playing around with swipe
Our system communicates with several web services providers. They are all invoked from a
I am working with a fairly complex solution in Visual Studio 2008. It contains
Recently I've begun looking into developing a simple CA/SCEP server. While the CA wasn't
I'm trying to get a rather JDK-sensitive piece of Oracle software working with Websphere,
I'm creating a site where user can create a node with multiple images attached.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.