Bar Chart Issue

2 posts, 0 answers
  1. Justin
    Justin avatar
    4 posts
    Member since:
    Jan 2011

    Posted 28 Jan 2011 Link to this post

    Hi, I'm really struggling to create a bar chart the way my boss wants it.
    If you have a look at the attached, what we are trying to achieve is the date across the bottom, then bars for each of the modules, so on the 10/12/2009, there would be three bars one for balancing, hospitality and membership.
    Hope somebody can help
  2. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 02 Feb 2011 Link to this post

    Hello Justin,

    You can achieve this scenario by creating a composite field in your business object that presents concatenated Date and Category like this:

    public class MyModel
    {
        public string Category { get; set; }
        public DateTime XValue { get; set; }
        public string CompositeCategory
        {
            get
            {
                return string.Format("{0}" + Environment.NewLine + "{1}", XValue.ToString(), Category);
            }
        }
        public double YValue { get; set; }
    }

    Setting the XCategory item mapping to this field will map the item to a separate bar the same way like in your image. Your series mapping can look like this:

    <telerik:SeriesMapping>
        <telerik:SeriesMapping.SeriesDefinition>
            <telerik:BarSeriesDefinition />
        </telerik:SeriesMapping.SeriesDefinition>
        <telerik:SeriesMapping.ItemMappings>
            <telerik:ItemMapping FieldName="CompositeCategory" DataPointMember="XCategory" />
            <telerik:ItemMapping FieldName="YValue" DataPointMember="YValue" />
        </telerik:SeriesMapping.ItemMappings>
    </telerik:SeriesMapping>

    Hope this helps!


    Best wishes,
    Yavor Ivanov
    the Telerik team
    Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top