SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components

0
0

Hello,

At right chart we have show only one X-axis which needs to update in real time .whenever new values will come we have to update in X-axis in itself instead of adding new line at X-Axis.

Each time New Y – axis will come that will append at left chart (Can be consider left chart showing history of right chart)

Let me know if anything further requred

Thanks.

Version
4.3.0.4660
Images
  • Yura Khariton
    Hi there. I’m not sure that I understand what you’re trying to achieve. Maybe you have some video or screenshot which demonstrate desired behavior?
  • vasim simform
    I have updated question please check and let me know if anything help required
  • vasim simform
    Hello Yura , Could you provide solution for this?
  • vasim simform
    In this one thing also I would like to add , How to prevent to change Y – axis value while chart is in real time ? like we have to put tile at Y – axis ( 0.1, 0.2 , 0.4 , 0.6 , 0.8 ,1.0) which should not be changed and X -value come incremental integer like 1,2,3,4,5,6….so on
  • vasim simform
    Hello Yura , Could you provide solution for this?
  • You must to post comments
0
0

Hi Vasim,

To prevent changes on YAxis’s VisibleRange you can set AutoRange.Never for axis and then manually set VisibleRange to (0, 1) as initial value. To show all axis labels like on screenshot you either need to set MajorDelta = 0.1 and disable auto ticks or create custom TickProvider and set ticks at desired positions:

final IAxis yAxis = sciChartBuilder.newNumericAxis().withAutoRangeMode(AutoRange.Never).withVisibleRange(0.0, 1.0).withAutoTicks(false).withMajorDelta(0.1).withMinorDelta(0.05).withDrawMinorTicks(false).build();

As for XAxis you just need to increment xValues by one when appending data in DataSeries.

Hope this will help you!

Best regards,
Yura

  • vasim simform
    Hello Yura , I implemented above code still its not working in real time chart Y-axis is changing its label , we have to stick Y- Axis label with this range (0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0)
  • Yura Khariton
    Can you share a code that reproduces this issue? With AutoRange.Never it shouldn’t change unless you set VisibleRange directly in your code or indirectly by using ChartModifier API ( e.g. by adding PinchZoomModifier which allows to zoom chart with pinch gesture ).
  • vasim simform
    fun topChart(sciChartSurface: SciChartSurface) { sciChartSurface.setBackgroundColor(Color.TRANSPARENT) // Obtain the SciChartBuilder instance val sciChartBuilder = SciChartBuilder.instance() // Create a numeric X axis val xAxis: IAxis = sciChartBuilder.newNumericAxis() .withDrawMinorGridLines(false) .withDrawMajorBands(false). withDrawLabels(false) .withDrawMajorGridLines(false) .withDrawMajorTicks(false) .withDrawMinorTicks(false) .withAutoRangeMode(AutoRange.Never) .build() val yAxis: IAxis = sciChartBuilder.newNumericAxis().withDrawMinorGridLines(false) .withDrawMajorTicks(false) .withDrawMinorTicks(false) .withFlipCoordinates(false) .withIsCenterAxis(false) .withDrawMajorBands(false) .withAutoRangeMode(AutoRange.Once) .withVisibleRange(0.1, 1.0) .withAutoTicks(false) .withIsLabelCullingEnabled(false) .withMajorDelta(1.0) .withMinorDelta(0.1).withDrawMinorTicks(false) .withDrawMajorGridLines(false).build() val lineData = XyDataSeries().apply { fifoCapacity = 100 } val lineSeries: IRenderableSeries = sciChartBuilder.newMountainSeries() .withDataSeries(lineData).withAreaFillColor(Color.parseColor(Constants.GRAPH_COLOR)) .withStrokeStyle(ColorUtil.Red, 0f, true) .build() sciChartSurface.renderableSeries.add(lineSeries) // Add the Y axis to the YAxes collection of the surface Collections.addAll(sciChartSurface.yAxes, yAxis) // Add the X axis to the XAxes collection of the surface Collections.addAll(sciChartSurface.xAxes, xAxis) // Add the annotation to the Annotations collection of the surface // Add the interactions to the ChartModifiers collection of the surface //Collections.addAll(sciChartSurface.getChartModifiers(), chartModifiers) val updateDataTask: TimerTask = object : TimerTask() { override fun run() { UpdateSuspender.using(sciChartSurface) { // Fill the DoubleValues collections lineData.append(x, criValue) // Zoom series to fit the viewport sciChartSurface.zoomExtents() ++x } } } val timer = Timer() val delay: Long = 0 val interval: Long = 1000 timer.schedule(updateDataTask, delay, interval) } //Real time data adding values between 0.1 to 1.0
  • Yura Khariton
    I see you have zoomExtents() call after adding data into lineData. This call changes both xAxis and yAxis VisibleRange to fit data displayed by chart. Please try to change it to zoomExtentsX()
  • vasim simform
    Yes It is working , but if you checked attached screenshot in that you can see right side another sci chart in that we have to show only one X – axis value like need to update only Y – axis in real time how I can do can you tell me that ? fun setupForRealTimeUpdateChart(sciChartSurface: SciChartSurface) { sciChartSurface.setBackgroundColor(Color.TRANSPARENT) // Obtain the SciChartBuilder instance val sciChartBuilder = SciChartBuilder.instance() // Create a numeric X axis val xAxis: IAxis = sciChartBuilder.newNumericAxis() .withDrawMinorGridLines(false) .withDrawMajorBands(false). withDrawLabels(false) .withDrawMajorGridLines(false) .withDrawMajorTicks(false) .withDrawMinorTicks(false) .withAutoRangeMode(AutoRange.Never) .build() val yAxis: IAxis = sciChartBuilder.newNumericAxis(). withAutoRangeMode(AutoRange.Never) .withDrawMajorTicks(false) .withDrawMajorBands(false) .withDrawMajorGridLines(false) .withDrawMinorGridLines(false) .withVisibleRange(0.1, 1.0) .withAutoTicks(false) .withMajorDelta(0.2) .withMinorDelta(0.2) .withDrawMinorTicks(false).build() val lineData = XyDataSeries().apply { fifoCapacity = 100 } val lineSeries: IRenderableSeries = sciChartBuilder.newMountainSeries() .withDataSeries(lineData).withAreaFillColor(Color.parseColor(Constants.GRAPH_COLOR)) .withStrokeStyle(ColorUtil.Red, 0f, true) .build() sciChartSurface.renderableSeries.add(lineSeries) // Add the Y axis to the YAxes collection of the surface Collections.addAll(sciChartSurface.yAxes, yAxis) // Add the X axis to the XAxes collection of the surface Collections.addAll(sciChartSurface.xAxes, xAxis) // Add the annotation to the Annotations collection of the surface // Add the interactions to the ChartModifiers collection of the surface //Collections.addAll(sciChartSurface.getChartModifiers(), chartModifiers) lineData.append(0,0.5) lineData.append(1,0.5) val updateDataTask: TimerTask = object : TimerTask() { override fun run() { UpdateSuspender.using(sciChartSurface) { // Fill the DoubleValues collections lineData.updateYAt(0, criValue) lineData.updateYAt(1, criValue) // Zoom series to fit the viewport sciChartSurface.zoomExtentsY() } } } val timer = Timer() val delay: Long = 0 val interval: Long = 1000 timer.schedule(updateDataTask, delay, interval) } Description : Assume we are getting real time values between (0.1 to 1.0) each second that we have to show in right chart with single X – axis with different Y-axis value (0.1 to 1.0) and then need to append each value to left chart(that left chat can be Consider history of till now values in real time) Left chart code put as in last comment section I’m expecting from you 1. Real time right chart update issue 2.Confirm from above description i did scichart integration properly or not
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.