This is a migrated thread and some comments may be shown as answers.

Bar Chart Issue

1 Answer 67 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Justin
Top achievements
Rank 1
Justin asked on 28 Jan 2011, 02:51 PM
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

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 02 Feb 2011, 08:42 AM
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.
Tags
Chart (obsolete as of Q1 2013)
Asked by
Justin
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or