PivotMap in SP1 Q2

4 posts, 0 answers
  1. Alex
    Alex avatar
    30 posts
    Member since:
    Aug 2010

    Posted 22 Sep 2011 Link to this post

    Hello!

    Can you give me a sample how to create Pivot Map with SP1 Q2.

    Because after update I cannot see any items.
    I do following (according your demo):

    PivotMap.LayoutStrategy = new SquarifiedStrategy();
    PivotMap.GroupDefinitions.Add(new GroupDefinition() { Member = "Genre" });
    PivotMap.ValuePath = "GrossSales";
    PivotMap.LabelPath = "Name";
    PivotMap.ToolTipPath = "GrossSales";
    PivotMap.ToolTipFormat = "Gross Sales: {0:C0}";
     
    List<MovieInfo> list = new List<MovieInfo>();
    list.Add(new MovieInfo() { GrossSales = 123, Name = "A1", Genre = "A"});
    list.Add(new MovieInfo() { GrossSales = 123, Name = "A2", Genre = "A" });
    list.Add(new MovieInfo() { GrossSales = 123, Name = "B1", Genre = "B" });
     
    PivotMap.ItemsSource = list;

    And I don't see any items.
    Thanks, Anatoly Chekh.
  2. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 26 Sep 2011 Link to this post

    Hello Alex,

    We created a small application using your code and it worked as expected. Perhaps the problematic code is elsewhere. I have attached the the test application so that you can test it in your environment.

    Kind regards,
    Yavor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Anatoly Chekh
    Anatoly Chekh avatar
    86 posts
    Member since:
    Apr 2010

    Posted 01 Oct 2011 Link to this post

    Hello!

    Yes, this solution works fine.
    But If I have some another implementation. I have own control that inherits grid. And add to this control RadPivotMap. In this case you solution isn't work.

    public class PivotMapContainer : Grid
    {
        public PivotMapContainer()
        {
              Chilren.Add(new RadPivotMap());
        }
    }
    ...
    Xaml:
    <UserControl>
        <PivotMapContainer />
    </UserControl>

    Thaks, Anatoly Chekh.
  5. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 03 Oct 2011 Link to this post

    Hello Anatoly Chekh,

    RadPivotMap implements ISupportInitialze interface for batch initializing of its properties. The xaml parser calls it automatically, but when you create it in code behind you have to call it manually like this:

    public PivotMapContainer()
    {
        RadPivotMap PivotMap = new RadPivotMap();
        PivotMap.BeginInit();
        this.Children.Add(PivotMap);
     
        // Initialize
        PivotMap.LayoutStrategy = new SquarifiedStrategy();
        PivotMap.GroupDefinitions.Add(new GroupDefinition() { Member = "Genre" });
        PivotMap.ValuePath = "GrossSales";
        PivotMap.LabelPath = "Name";
        PivotMap.ToolTipPath = "GrossSales";
        PivotMap.ToolTipFormat = "Gross Sales: {0:C0}";
     
        List<MovieInfo> list = new List<MovieInfo>();
        list.Add(new MovieInfo() { GrossSales = 123, Name = "A1", Genre = "A" });
        list.Add(new MovieInfo() { GrossSales = 123, Name = "A2", Genre = "A" });
        list.Add(new MovieInfo() { GrossSales = 123, Name = "B1", Genre = "B" });
     
        PivotMap.ItemsSource = list;
        PivotMap.EndInit();
    }

    I have attached the sample application modified to your scenario working as expected.
    Hope this helps! Kind regards,
    Yavor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top