Pre loader

1

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

All Answers » Re: Update X - Axis (Only 1 X-Axis) with Different Y - Axis » Comments for "Re: Update X - Axis (Only 1 X-Axis) with Different Y - Axis"
  • 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
  • vasim simform
    Hello Yura , Can you reply for last comment ?
  • Yura Khariton
    Hi Vasim, I’m sorry, but I don’t understand what you’re trying to achieve from this description. Can you provide more information about what you currently achieved vs what you’re trying to implement ( maybe you have some screenshot which demonstrate desired ouput )?
  • vasim simform
    Assume that I have to show only Single X (For New Values needs to update only or Consider only one item in data series which we have to update only ) with Different Y values Like First time I append by this scichart.append(0,0.0) Now I am getting data each seconds so I need to update only Y values at X- axis no need to append new X in chart instead of needs update Y value itself with same X index. (1) Next new values for Y – Axis = 0 .67 scichart.append(0,0.67) (2) Next new values for Y – Axis = 0 .75 scichart.append(0,0.75) ……..so on need to update Y- axis value for same X index I hope you will understand this time
  • Yura Khariton
  • vasim simform
  • vasim simform
    XyDataSeries.append(0,0.5) I’m not able add single X- axis and Update Please provide solutions for this
  • Yura Khariton
    To fix 404 error please try to copy entire link (with ‘.html’ ending). As for your question – I don’t understand what you mean. You asked how to update only Y value and don’t change X value. This can be achieved using updateYAt() method. Maybe I misunderstood your requirements and in this case please provide more information