Jump to content
Software FX Community

scrollbar location


tron

Recommended Posts

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;
Link to comment
Share on other sites

  • 2 weeks later...

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!

Link to comment
Share on other sites

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

post-5660-13922409681175_thumb.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...