Welcome to the Xceed Community | Help
Community Search  

Multiple Bar Series question

Sort Posts: Previous Next
  •  01-24-2008, 9:21 PM Post no. 6576

    Multiple Bar Series question

    If I have multiple bar series how can I make them start from specified x-axis instead of all of them starting from 0, i.e.

    || [ ]
    || [ ]
    || [ ]
    =====

    instead of

    [||]
    [||]
    [||]
    ======

    Thanks
  •  01-30-2008, 10:47 AM Post no. 6577 in reply to 6576

    Re: Multiple Bar Series question

    To be able to specify the X position with a BarSeries, you need to use the ShapeSeries instead.

    <code>
    private void Form1_Load( object sender, EventArgs e )
    {
    Chart m_chart = chartControl1.Charts[ 0 ];

    Axis Xaxis = m_chart.Axis( StandardAxis.PrimaryX );
    Xaxis.ScaleMode = AxisScaleMode.Numeric;
    Xaxis.NumericScale.AutoMax = false;
    Xaxis.NumericScale.AutoMin = false;
    Xaxis.NumericScale.Max = 5;
    Xaxis.NumericScale.Min = -2;

    ShapeSeries m_Shape = ( ShapeSeries )m_chart.Series.Add( SeriesType.Shape );
    m_Shape.UseXValues = true;

    // add Bar1
    m_Shape.AddShape( 10, // Y center of bar -> half its Y size
    -1, // X position - not used since UseXValue is set to false
    0, // Z position - not used since UseZValue is set to false
    0.5, // X size - half category in width
    20, // Y size of bar
    0.66, // Z size - 2 thirds of series depth
    "Bar1", // label
    new FillEffect( Color.LightGreen ), // filling
    new LineProperties( 1, Color.Black ) // border
    );

    // add Bar2
    m_Shape.AddShape( 20, // Y center of bar -> half its Y size
    2, // X position - not used since UseXValue is set to false
    0, // Z position - not used since UseZValue is set to false
    0.33, // X size - approximately 1 third of category width
    40, // Y size of bar
    0.33, // Z size - 1 third of series depth
    "Bar2", // label
    new FillEffect( Color.LightCoral ), // filling
    new LineProperties( 1, Color.Black ) // border
    );

    // add Bar3
    m_Shape.AddShape( 15, // Y center of bar -> half its Y size
    3, // X position - not used since UseXValue is set to false
    0, // Z position - not used since UseZValue is set to false
    0.5, // X size - half category width
    30, // Y size of bar
    0.5, // Z size - half series depth
    "Bar3", // label
    new FillEffect( Color.LightSalmon ), // filling
    new LineProperties( 1, Color.Black ) // border
    );
    }
    </code>
    Charles Bérubé-Rémillard
    Technical Support
    Xceed Software Inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.