Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
Composite Chart with 3D Charts
posted

Is it possible to use 3D charts in a composite chart? I would see no problem with this but I was modifying a 3DLineChart class I put together so that the legend and chart would load in seperate chart areas and I had some bugs. So I attempted to recreate what I wanted in the designer and work backwards from there but I noticed that only non-3D charts are available for composite charts. That is why I am assuming 3D charts cannot be used in Composites and that would help explain my bugs.

With that said, maybe there is a simpler solution to what I want. There are two things that are keeping this particular chart from being complete 1) White padding all around my chart that is limiting how large I can scale it too, is there any way to trim this to 0? 2) Is there anyway to load a Legend as a seperate item on top of my chart so I can set its Bounds to anywhere on the chartarea? As stated above, I was trying to load them on seperate areas but had little success.

Here is the basic flow of my class:
1) Create UltraChart
2) Configure UltraChart
3) Set UltraChart datasource
4) Bind UltraChart data
5) Scale Chart according to rows in datatable
6) Add Chart to Page

This chart needs to be loaded dynamically so I have to create them in the code behind so examples/answers in C# would be appreciated!

Thanks.

 

  • 26458
    Offline posted
    Unfortunately, 3d charts cannot be used as composite layers.
    Have you tried increasing chart.Transform3D.Scale to minimize the white space? That's about the only thing you can do. The white space is there to accomodate for possible chart rotations. As for the legend, you can do one of two things (both of them can be done by handling FillSceneGraph event): Create a legend from scratch by adding Box and Text primitives to e.SceneGraph or changing the bounds and locations of the existing legend's primitives. Try using something like this (change Text.bounds and Box.rect according to your needs):

    private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
    {

    PrimitiveCollection legendPrimitives = new PrimitiveCollection();
    foreach (Primitive p in e.SceneGraph)
    {
       if (p.Path != null && p.Path.ToLower().IndexOf("legend") != -1)
       {
          legendPrimitives.Add(p);
       }
    }

    if (legendPrimitives.Count == 0) return;
    GraphicsContext gc = new GraphicsContext();
    gc.ResetClip();
    e.SceneGraph.InsertBefore(gc, legendPrimitives[0]);

    foreach (Primitive p in legendPrimitives)
    {
       if (p is Box)
       {
          ((
    Box)p).rect = new Rectangle(x, y, w, h);
       }

       if (p is Text)
       {
          ((
    Text)p).bounds = new Rectangle(x, y, w, h);
       }
    }
    }