tron Posted May 8, 2009 Report Share Posted May 8, 2009 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. Quote Link to comment Share on other sites More sharing options...
TatianaG Posted May 13, 2009 Report Share Posted May 13, 2009 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; Quote Link to comment Share on other sites More sharing options...
tron Posted May 22, 2009 Author Report Share Posted May 22, 2009 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! Quote Link to comment Share on other sites More sharing options...
JuanC Posted May 22, 2009 Report Share Posted May 22, 2009 This is a bug, we should have a hotfix next week. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
tron Posted May 22, 2009 Author Report Share Posted May 22, 2009 Ok. Thanks for the quick reply. Quote Link to comment Share on other sites More sharing options...
thubble Posted May 25, 2009 Report Share Posted May 25, 2009 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. Quote Link to comment Share on other sites More sharing options...
JuanC Posted June 1, 2009 Report Share Posted June 1, 2009 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 Quote Link to comment Share on other sites More sharing options...
thubble Posted June 9, 2009 Report Share Posted June 9, 2009 That code worked - thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.