How to set width of rectangle from code behind

2 posts, 0 answers
  1. Maheep
    Maheep avatar
    4 posts
    Member since:
    Dec 2010

    Posted 06 Dec 2010 Link to this post

    I am using following code to generate a Bar chart.

     

    var

     

     

    seriesMapping = new SeriesMapping
    {
        SeriesDefinition =
    new BarSeriesDefinition
        {
            ShowItemLabels =
    false
        }
    };

     

     

     

     

    var timeMapping = new ItemMapping
    {
        DataPointMember =
    DataPointMember.XValue,
        FieldName =
    "Time",
        FieldType =
    typeof(DateTime);
    };

     

     

     

    var pointMapping = new ItemMapping
    {
        DataPointMember =
    DataPointMember.YValue,
        FieldName =
    "Point",
        FieldType =
    typeof(double),
    };

     

    seriesMapping.ItemMappings.Add(timeMapping);
    seriesMapping.ItemMappings.Add(pointMapping);

    Chart1.SeriesMappings.Add(seriesMapping);



    I want to set width of rectangle drawn for a Bar to "2". How can I do this from code behind; not using style?

  2. Maheep
    Maheep avatar
    4 posts
    Member since:
    Dec 2010

    Posted 06 Dec 2010 Link to this post

    Ok. Got the answer. I had to change Fill value in Style from default templateBinding value to a fill color and it worked.
Back to Top