Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
630
Customizing X Axis on a Column Chart
posted

How can I remove the series names in the chart below. Because I am using a legend, I want to remove the series labels 'open' and 'closed'. I then would like to have the label item (a formatted date string ) appear below the columns. I am using the 2010.1 version of webchart

  • 630
    Verified Answer
    Offline posted

    I figured it out-

    As the documentation states, in this case the X axis is a SetLabelAxis Object. However it took some figuring out to determine what that really meant. In the chart.Axis.X, there is a SeriesLabels and an itemFormat. By setting the itemFormat to None, the Open and Closed labels did not appear. Now I needed to set the formatting of the Series Label to look like the item format. Here is what I did:

     

    // X Axis setup

    myChart.Axis.X.Labels.Font = AxisFont;

    myChart.Axis.X.TickmarkStyle =

     

    AxisTickStyle

    .DataInterval;

    myChart.Axis.X.LineThickness =

     

    this

    .axisLineThickness;

    myChart.Axis.X.TickmarkInterval = XAxisTickMarkInterval;

    myChart.Axis.X.MajorGridLines.Visible =

     

    false

    ;

    myChart.Axis.X.MinorGridLines.Visible =

     

    false

    ;

    myChart.Axis.X.Labels.ItemFormat =

     

    AxisItemLabelFormat

    .None;

    myChart.Axis.X.Labels.SeriesLabels.Orientation =

     

    TextOrientation

    .Custom;

    myChart.Axis.X.Labels.SeriesLabels.OrientationAngle = 315;

    myChart.Axis.X.Labels.SeriesLabels.Flip =

     

    false

    ;

    myChart.Axis.X.Labels.SeriesLabels.VerticalAlign = System.Drawing.

     

    StringAlignment

    .Near;

    myChart.Axis.X.Labels.SeriesLabels.Font =

     

    new System.Drawing.Font("Verdana"

    , 10);

    myChart.Axis.X.Labels.SeriesLabels.FontColor = System.Drawing.

     

    Color

    .Black;

    myChart.Axis.X.Labels.SeriesLabels.Visible =

     

    true

    ;