Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18876 |

    Hello,

    I load chartcontrol into chart Toolbar and write function for loading charttoolbar.
    My code is :

    public Window1()
    {
    InitializeComponent();

    objChartControl = new ChartControl();
    nChartToolbarControl1 = new ChartToolbarControl();
    objRandom = new Random();

    #region –> Hosting XCeed Chart in WPF <–

    LoadGraph();

    WindowsFormsHost objWindowsFormsHost = new WindowsFormsHost();
    <b>objWindowsFormsHost.Child = nChartToolbarControl1; </b>
    objWindowsFormsHost.Margin = new Thickness(10,100,10,10);
    grdMainGrd.Children.Add(objWindowsFormsHost);

    #endregion

    }

    private void ResetToolbarConfig(ChartControl UCChart)
    {
    // configure the toolbar
    ChartToolbarButtonsArray arrButtons = new ChartToolbarButtonsArray(nChartToolbarControl1);

    arrButtons.Add(ChartToolbarButtons.Load);
    arrButtons.Add(ChartToolbarButtons.Save);
    arrButtons.Add(ChartToolbarButtons.Print);
    arrButtons.Add(ChartToolbarButtons.ImageExport);
    arrButtons.Add(ChartToolbarButtons.Separator);

    arrButtons.Add(ChartToolbarButtons.ActiveChart);
    arrButtons.Add(ChartToolbarButtons.Wizard);
    arrButtons.Add(ChartToolbarButtons.ChartEditor);
    arrButtons.Add(ChartToolbarButtons.Separator);

    arrButtons.Add(ChartToolbarButtons.RotateLeft);
    arrButtons.Add(ChartToolbarButtons.RotateRight);
    arrButtons.Add(ChartToolbarButtons.ElevationUp);
    arrButtons.Add(ChartToolbarButtons.ElevationDown);
    arrButtons.Add(ChartToolbarButtons.ZoomIn);
    arrButtons.Add(ChartToolbarButtons.ZoomOut);
    arrButtons.Add(ChartToolbarButtons.OffsetXLeft);
    arrButtons.Add(ChartToolbarButtons.OffsetXRight);
    arrButtons.Add(ChartToolbarButtons.OffsetYUp);
    arrButtons.Add(ChartToolbarButtons.OffsetYDown);
    arrButtons.Add(ChartToolbarButtons.Separator);

    arrButtons.Add(ChartToolbarButtons.Orthogonal);
    arrButtons.Add(ChartToolbarButtons.Perspective);
    arrButtons.Add(ChartToolbarButtons.View2D);
    arrButtons.Add(ChartToolbarButtons.PredefinedProjection);
    //arrButtons.Add(ChartToolbarButtons.PredefinedLightScheme);
    arrButtons.Add(ChartToolbarButtons.Separator);

    arrButtons.Add(ChartToolbarButtons.MouseTrackball);
    arrButtons.Add(ChartToolbarButtons.MouseZoom);
    arrButtons.Add(ChartToolbarButtons.MouseOffset);
    arrButtons.Add(ChartToolbarButtons.MouseDisabled);
    arrButtons.Add(ChartToolbarButtons.Separator);

    arrButtons.Add(ChartToolbarButtons.IncreaseChartWidth);
    arrButtons.Add(ChartToolbarButtons.IncreaseChartHeight);
    arrButtons.Add(ChartToolbarButtons.IncreaseChartDepth);
    arrButtons.Add(ChartToolbarButtons.DecreaseChartWidth);
    arrButtons.Add(ChartToolbarButtons.DecreaseChartHeight);
    arrButtons.Add(ChartToolbarButtons.DecreaseChartDepth);

    arrButtons.Add(ChartToolbarButtons.PredefinedLightScheme);
    arrButtons.Add(ChartToolbarButtons.ImageBorder);
    arrButtons.Add(ChartToolbarButtons.BackgroundFillEffect);
    arrButtons.Add(ChartToolbarButtons.Separator);
    arrButtons.Add(ChartToolbarButtons.RenderDevice);

    <b>nChartToolbarControl1.ButtonsConfig = arrButtons;
    nChartToolbarControl1.ChartControl = UCChart;</b>
    }

    private void LoadGraph()
    {
    objChartControl.Settings.RenderDevice = RenderDevice.OpenGL;
    objChartControl.Background.FillEffect.SetSolidColor(Color.AliceBlue);

    ChartLabel objChartLabel = objChartControl.Labels.AddHeader(“GSM Version 1.5”);
    objChartLabel.TextProps.Backplane.Visible = false;
    objChartLabel.TextProps.FillEffect.Color = Color.Navy;
    objChartLabel.TextProps.Shadow.Type = ShadowType.Solid;
    objChartLabel.TextProps.HorzAlign = HorzAlign.Left;
    objChartLabel.TextProps.VertAlign = VertAlign.Top;
    objChartLabel.HorizontalMargin = 4;
    objChartLabel.VerticalMargin = 4;

    ((Legend)objChartControl.Legends[0]).Mode = LegendMode.Automatic;

    objChart = objChartControl.Charts[0];

    <b>ResetToolbarConfig(objChartControl);
    nChartToolbarControl1.Controls.Add(objChartControl);</b>
    }

    but the problem is that I cant get proper position of chartcontrol in charttoolbar.
    Height and width and margin are not properly set.
    though I try to set Height,Weight,Margin but I get chartcontrol in very small size and not with proper posion.

    plz help me for setting chartcontrol in charttoolbar.

    Thanx,
    Khushboo

    Imported from legacy forums. Posted by khushboo (had 2555 views)

    Xceed Support
    Member
    Post count: 5658

    Instead of adding the ChartControl to the Controls of the ChartToolbarControl, you should them both to a Panel. That way, your layout will be easier to manage.

    <code>
    Panel panel1 = new Panel();
    this.Controls.Add( panel1 );
    panel1.Controls.Add( nChartToolbarControl1 );
    panel1.Controls.Add( objChartControl );
    </code>

    Imported from legacy forums. Posted by CharlesB (had 3187 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.