in

Software FX Community

Discuss and find help for all Software FX products.

scrollbar location

Last post 06-09-2009 4:41 PM by thubble. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 05-08-2009 6:45 PM

    • tron
    • Top 500 Contributor
    • Joined on 05-08-2009

    scrollbar location

    Hello,

    I have a Gantt chart with a scrollbar.  How do you change the location of the scrollbar to the right side of the chart without inverting the entire chart?

    Thanks.

  • 05-13-2009 12:45 PM In reply to

    Re: scrollbar location

    You can't change the location of the scroll bar. For a Gantt chart, the AxisX scrollbar will appear at the left and the AxisY scrollbar will appear at the bottom of the chart. However, there is a way to create a scrollbar at the right of the chart: you can add a new AxisX. Please try the following code:

    AxisX axis = new AxisX();axis.Visible = true;

    axis.Min = 0;

    axis.Max = 12;//You need to set the Min and Max values, otherwise the Axis won't appear. You can use any values.

    axis.TextColor = Color.Transparent;//This is for hiding the values of the new Axis if you don't want them to be displayed.

    chart1.AxesX.Add(axis);

    chart1.AxesX[1].AutoScroll = true;

    Tatiana Gonzalo
    Software FX Support
    Filed under: , ,
  • 05-22-2009 6:01 PM In reply to

    • tron
    • Top 500 Contributor
    • Joined on 05-08-2009

    Re: scrollbar location

    Thanks for your help Tatiana.  I will try that.

    On a similar note.  The scrollbar, specifically for the Gantt chart, seems to scroll in the wrong direction.  The data follows the scrollbar where in other scrollbars the data goes in the opposite direction of the scrollbar. Is this meant to be like this?  Is there a way I can change this behavior?

     Thanks again!

  • 05-22-2009 7:08 PM In reply to

    • JuanC
    • Top 10 Contributor
    • Joined on 03-02-2007

    Re: scrollbar location

    This is a bug, we should have a hotfix next week.

    Regards,

    JuanC

  • 05-22-2009 7:15 PM In reply to

    • tron
    • Top 500 Contributor
    • Joined on 05-08-2009

    Re: scrollbar location

    Ok. Thanks for the quick reply.

  • 05-25-2009 1:51 PM In reply to

    Re: scrollbar location

    The example code above seems to be for previous versions of ChartFX. Is there a way to have the scrollbar on the right side in ChartFX for WPF? I thought it could be done using a template for AxisX, but I'm not sure how.

    Thanks.

  • 06-01-2009 5:17 PM In reply to

    • JuanC
    • Top 10 Contributor
    • Joined on 03-02-2007

    Re: scrollbar location

    You can achieve this in ChartFX for WPF but you have to make sure you use build 3434 or newer. You will have to create an extra X axis so that you have an axis with labels but not scrollbar and another with a scrollbar but no labels.

    Axis axisMain = chart1.AxisX;

    chart1.Series.Clear();
    chart1.Series.Add(
    new SeriesAttributes("Value"));

    Axis axisExtra = new Axis();
    axisExtra.Position =
    AxisPosition.Near;
    axisExtra.AxisStyle |=
    AxisStyles.Categorical;
    axisExtra.Labels.BindingPath =
    "Name";
    axisExtra.ScrollBar.Visibility =
    Visibility.Collapsed;
    chart1.AxesX.Add(axisExtra);
    axisMain.Labels.BindingPath =
    "Name";
    axisMain.Labels.Visibility =
    AxisLabelVisibility.Collapsed;
    axisMain.Position =
    AxisPosition.Far;
    axisMain.ScrollBar.Margin =
    new Thickness(-1, 0, 0, 0);
    axisMain.ScrollViewChanged +=
    new EventHandler(OnScrollViewChanged);
    axisMain.Grids.Major.Visibility =
    Visibility.Collapsed;
    axisMain.Grids.Major.TickMark =
    TickMark.None;
    axisMain.Grids.Minor.Visibility =
    Visibility.Collapsed;
    axisMain.Grids.Minor.TickMark =
    TickMark.None;

    chart1.DataBound += new EventHandler(OnDataBound);

    private void OnDataBound (object sender, EventArgs e)
    {
      chart1.AxisX.SetScrollView(1, 5);
    }
    private void OnScrollViewChanged (object sender, EventArgs e)
    {
      Axis axisMain = chart1.AxesX[0];
      Axis axisExtra = chart1.AxesX[1];

      double min = Math.Truncate(axisMain.ScrollPosition);
      axisExtra.SetScrollView(min + 1, min + 5);
    }

    You can download our most recent hotfix here.

    Regards,

    JuanC

  • 06-09-2009 4:41 PM In reply to

    Re: scrollbar location

    That code worked - thanks!

Page 1 of 1 (8 items)
Copyright 2008 Software FX, Inc.