I want some specific behavior out of my X and Y axes. Right now I have custom code which modifies the ranges for the axes to get the behavior I want. It would be nice to just do this by setting options on the axes.
For my Y axis I want to use the AutoRange feature but the default seems a little crowded. Instead of it ranging to the min and max of the data series I want it to show a little room on the top and bottom.
For the X axis I want to show exactly the most recent hour of data.
Thanks for any help.
- dlee asked 12 years ago
- You must login to post comments
HI dlee,
You can use the AxisBase.GrowBy property to achieve this. This will add a fractional padding above/below the axis (on X or Y axis). For an example, please see here:
http://http://www.scichart.com/Abt.Controls.SciChart.SL.ExampleTestPage.html#/Abt.Controls.SciChart.Example;component/Examples/IWantTo/CreateSimpleChart/LineChartExampleView.xaml
<!-- Create the chart surface --> <SciChart:SciChartSurface Name="sciChart" SciChart:ThemeManager.Theme="ExpressionDark"> <!-- Declare RenderableSeries --> <SciChart:SciChartSurface.RenderableSeries> <SciChart:FastLineRenderableSeries SeriesColor="#FF4083B7" StrokeThickness="2"/> </SciChart:SciChartSurface.RenderableSeries> <!-- Create an X Axis with Growby --> <SciChart:SciChartSurface.XAxis> <SciChart:NumericAxis> <SciChart:NumericAxis.GrowBy> <SciChart:DoubleRange Min="0.1" Max="0.1"/> </SciChart:NumericAxis.GrowBy> </SciChart:NumericAxis> </SciChart:SciChartSurface.XAxis> <!-- Create a Y Axis with Growby --> <SciChart:SciChartSurface.YAxis> <SciChart:NumericAxis> <SciChart:NumericAxis.GrowBy> <SciChart:DoubleRange Min="0.1" Max="0.1"/> </SciChart:NumericAxis.GrowBy> </SciChart:NumericAxis> </SciChart:SciChartSurface.YAxis> </SciChart:SciChartSurface>
which results in this output:
- SciChart answered 12 years ago
-
Thank you for your response Andrew. This is very similar to what I am doing currently. Except I am doing a RaisePropertyChanged on my RenderableSeries collection on a timer to update the X axis. I assume the rendered event is called as a byproduct of this. By your response I'm guessing that currently there is no way to set an axis range the way I want to without setting up some kind of timer and updating the axis through the program. Some kind of way to set a fixed window size would be a nice feature to have. Thanks again!
-
Hello Andrew, I have a CategoryDateTimeAxis as my XAxis. There is a total of about 300 data points and setting VisibleRange of the axis between 0 and 100 using IndexRange. We are displaying the data using CandleStickSeries. We want some spacing between the last candle on the extreme right and the y axis which is set to Alignment.Right. I have tried to use Axis.GrowBy = new DoubleRange(0.1, 0.1). This does not seem to have any effect. I dont see any padding added between the last candle and the Y-Axis. Is there something different that needs to be done to achieve this? On a general note, setting MinorDelta, MajorDelta has been a challenge for CategoryDatetime axis. Please advise. Thank you! Copying the code here.. Dim datetimeaxis = New CategoryDateTimeAxis() datetimeaxis.VisibleRange = New IndexRange(0, 200) datetimeaxis.DrawMajorBands = False datetimeaxis.DrawMinorGridLines = False datetimeaxis.DrawMajorGridLines = False datetimeaxis.Padding = New Thickness(2) datetimeaxis.GrowBy = New DoubleRange(0.02, 0.02) datetimeaxis.Scrollbar = scrollbar m_chart.XAxis = datetimeaxis
-
GrowBy is used in our examples with CategoryDateTimeAxis to create padding on the right. Please see https://www.scichart.com/wpf-chart-example-realtime-ticking-stock-charts/ which sets XAxis.GrowBy to new DoubleRange(0, 0.1)
-
Hi Andrew, I am trying to use CategoryDateTimeAxis on XAxis and I don’t understand why it’s not working as expected. My code looks like this: XAxis.GrowBy = new DoubleRange(0, 0.1); XAxis.DrawMinorGridLines=false; XAxis.DrawMajorBands = true; XAxis.Padding = new Thickness(2); . The problem is that all the data series are aligned on the same x axis. There is no space between them. Is there something that I need to set in order to know the distance between two data series? Thank you.
-
Maybe open a new forum question with the exact steps to reproduce and expected vs. Actual results?
- 2 more comments
- You must login to post comments
Please login first to submit.