Pre loader

Category: Android

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

0 votes
2k views

Hi,

When using splinerenderable series, there visual issues (as if the data points are unsorted) with the spline line at certain zoom levels.
If you zoom in past a certain point, the spline line corrects itself, showing that the data points are sorted in order.
See the attached screenshot and project replicating the issue.
This issue may be related to other issues currently active:

0 votes
0 answers
2k views

Hi,

Our current chart setup is as follows: 2 charts, each with 2 line series (~23k data points per line series – datetime [x-axis], double[y-axis]), data is added to the line series in real-time and all data is retained (never deleted). Both charts share a motion events group (pinchzoom, rollover, xaxisdrag, zoomextents).
Of the 2 Line series, each line series can be removed or added to the chart at random.

We noticed that an index out of bounds error occurs if you quickly add/remove a new line series (plus data) and start zooming in/out quickly, as much as possible. – easiest way to replicate issue. In some cases, if you zoom in with an already loaded lines series, the error still comes up.
See attached txt logs.

I considered completely disabling chart interaction (by disabling chart modifiers) before adding or removing a line series, however, this caused other issues such as vertical annotations being removed.

0 votes
2k views

Hi,

Our current chart setup is as follows: 2 charts, each with 2 line series (~23k data points per line series – datetime [x-axis], double[y-axis]), data is added to the line series in real-time and all data is retained (never deleted). Both charts share a motion events group (pinchzoom, rollover, xaxisdrag, zoomextents).

If you zoom in to the furthest zoom possible, the chart/app starts to act extremely sluggish, then crashes eventually. – see attached txt file for logs.

Questions:

  1. Is there a method to tackle this from a performance perspective and still enable zooming to the utmost limit?
  2. If 1.) is not possible, is it possible to enact a zoom limit on the charts?

Other solution suggestions are welcome.

0 votes
4k views

We are working on an android based ELD application. We are looking for a ELD graph. Is it possible to accomplish this using SCICHART?

0 votes
1k views

Is there an API of extension that would enable time-based average (e.g. average 10 minutes worth of data points) down-sampling of measurements?
Or is resorting to pre-filter provided data points the only option?

0 votes
1k views

I have a strange padding in the end of the chart. I set drawLabels false and added annotations to it. And added makerPoint for the last point. So everything is clipped by this padding.

You can see this on the screenshot in the attachment

0 votes
1k views

I want to format my labels after tapping a radio button. But the major labels with the “dd mm” pattern and the minor labels with the “HH:mm” pattern. If I check the radio button in the radio button group the labels will format with the others formats. It works with TradeChartAxisLabelProvider but I can’t handle it with my own formats. What I have to use?

0 votes
1k views

What is the best way to form List with my formatted dates in the View Model and just put in my implementation of CategoryLabelProviderBase?

Can an AxisBase implementation help me in this case?

0 votes
0 answers
5k views

I have a strange margin in the end of the chart. But AxisMarkerAnnotations don’t have this margin. Only series and HorizontalLineAnnotation. Look at the picture:

enter image description here

Where did it come from?

And maybe I can add margins to max and mix values?

0 votes
5k views

I am looking to customize the shape of the rollover vertical line (Android) – particularly, make it dashed and potentially increase the line thickness.
I saw that this is possible for WPF (https://www.scichart.com/questions/wpf/crosshair-cursormodifier-color-and-thickness), but was not able to find any information for Android.

Is this styling capable in Android?

0 votes
1k views

I have a chart and a radio button group. When I click a button an app will load new data. And it works ok. But sometimes my chart doesn’t scroll to start when data is changed. I changed visibleRange for it. It can be fixed with postDelayed method but is there any good way to fix it?

My code:

enter link description here

0 votes
1k views

I get an error when I scroll my chart. I didn’t change my code. It worked yesterday and it doesn’t today. I just started getting:

VisibleRange was restored to its last valid value. The range class com.scichart.data.model.DoubleRange (Min = 0.0, Max = 307.0) either is not valid or it doesn’t satisfy MinimalZoomConstrain or MaximumZoomConstrain. To provide fallback value please override AxisCore#coerceVisibleRange(IRange) method

I tried to make my MinimalZoomConstrain to zero and MaximumZoomConstrain to maximum. But it didn’t help me. I tried override coerceVisibleRange but I don’t kwon how

My code when chart points received in attachment

1 vote
0 answers
4k views

Hello there,
I am testing your 3D chart by creating single chart and adding multi data on condition.Whenever adding new data I clear previous.
surfaceCommon3D.getRenderableSeries().clear();
surfaceCommon3D.getChartModifiers().clear();

Issues is when first data add tooltip working properly and after adding new data then checking tooltip value Application will crash and show this error:
java.lang.ArrayIndexOutOfBoundsException: index
at com.scichart.core.model.DoubleValues.get(SourceFile:6)
at com.scichart.charting3d.visuals.renderableSeries.hitTest.MeshSeriesInfo3D.update(SourceFile:10)

here is my tooltip snippet code:
TooltipModifier3D t1 = new TooltipModifier3D();
t1.setReceiveHandledEvents(true);
t1.setExecuteOnPointerCount(1);
surfaceCommon3D.getChartModifiers().add(new ModifierGroup3D(t1));

SurfaceMeshRenderableSeries3D snippet code:
rs = sciChart3DBuilder.newSurfaceMeshSeries3D()
.withDataSeries(ds)
.withDrawMeshAs(DrawMeshAs.SolidWireframe)
.withStroke(blackColor)
.withContourStroke(stroke)
.withStrokeThicknes(1f)
.withDrawSkirt(false)
.withMeshColorPalette(new GradientColorPalette(colors, stops))
.withMetadataProvider(new SurfaceMeshMetadataProvider3D(pnl_time_spot_Z_3d, xSize, “common3DChartLayout”))
.withSeriesInfoProvider(new CustomSeriesInfo3DProvider1(fromModel, xSize))
.build();

UpdateSuspender.using(surfaceCommon3D, new Runnable() {
@Override
public void run() {
surfaceCommon3D.setCamera(camera);
surfaceCommon3D.setXAxis(xAxis);
surfaceCommon3D.setYAxis(yAxis);
surfaceCommon3D.setZAxis(zAxis);
surfaceCommon3D.getRenderableSeries().add(rs);
surfaceCommon3D.invalidate();
}
});

I am Requesting you to solved my issues ASAP.
Thanks in Advance

0 votes
0 answers
4k views

Hello there,
I am testing your 3d chart in demo project but I added X,Y and Z data, also added tool-tip to check the value

final TooltipModifier3D tooltipModifier3D = new TooltipModifier3D();
tooltipModifier3D.setIsEnabled(true);
tooltipModifier3D.setMarkerPlacement(Placement.TopRight);
tooltipModifier3D.setExecuteOnPointerCount(1);
tooltipModifier3D.setCrosshairMode(CrosshairMode.Lines);
surfaceCommon3D.getChartModifiers().add(tooltipModifier3D);

And also implement custom tool-tip UI.

The Issues is when I hover cursor on chart it not showing exact position on tool-tip. I attach SS png you can check it,
SS showing my cursor is on position x=6 but on tooltip it showing x=2.Waiting for your reply.

Thanks You

0 votes
4k views

I want to make my labels positions in the centre of axis (y axis which is transparent). Only three labels have to be showed. On the same height with the min, max and actual points. How can I achieve this.

enter image description here

0 votes
1k views

I looked at this answer for WPF.

https://stackoverflow.com/questions/10231627/convert-pixels-to-cm-in-wpf

Is there a similar option to get the dimensions in mm on Android?

0 votes
0 answers
2k views

Hello there,
I am testing SciChartSurface3D its working fine but when I do some changes with height in chart layout it not render properly and getting error:

E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xeb0966f0
E/emuglGLESv2_enc: Out of bounds vertex attribute info: clientArray? 1 attribute 1 vbo 129 allocedBufferSize 672 bufferDataSpecified? 1 wantedStart 0 wantedEnd 889012

I am requesting to please check this error.

0 votes
0 answers
1k views

Hello

Is it possible do detect taps/selection/click over Axis Titles?

Thanks!

0 votes
0 answers
4k views

Hello

Is it possible do detect taps/selection/click over the PointMarkers?

Thanks!

0 votes
1k views

Hello,

I am having trouble determining the parameters to pass to ModifierTouchEventArgs when overriding GestureModifierBase in the latest SciChart versions. I can’t figure out where to get the now required source and target values – the super class returns null when asked.. Code snippet below…

class MyCustomGestureModifier() : GestureModifierBase() {
    override fun onLongPress(e: MotionEvent?) {
    super.onLongPress(e)

    /* This worked in SciChart v4.2.0.4557, but no longer does due to ModifierTouchEvents now requiring source and target
    val args = ModifierTouchEventArgs()
    args.e = e
    args.isHandled = false
    args.isMaster = true
    args.isInSourceBounds = true
     */

    // create touch event args for rollover modifier
    // 4.3.0.4646 wants additional parameters for source and target
    val orgEvent = originalTouchEvent // this is null, so where should we get source and target?
    val args = ModifierTouchEventArgs(orgEvent.source, orgEvent.target)
    args.e = e
    args.isHandled = false

    rolloverModifier.onTouch(args)

    args.clear()
}

In case it helps, the above snippet is based on a previous discussion at https://www.scichart.com/questions/android/separating-rollover-tootips-and-pan-drag

Thank you.

  • C Bolton asked 2 years ago
  • last active 2 years ago
0 votes
1k views

Hello
My question is, if I buy a program license, where should I put the license ? If I statically place it in the application class, it can be easily accessed by decompiling the apk file and it can be stolen by others.

0 votes
2k views

Real Time EEG LiVE chart of 24 channels, jumps two x minor gridlines at a time . How to make it to move one gridline at a time ?

Is there any setting for that ?

0 votes
1k views

Now we have 24 channels added to one graph which is visible in one page or one screen of the mobile. Can we make it two pages or add a scroll bar and devide the channels into 12 each without two different scichart components

0 votes
1k views

I am using stepped yaxis graph – ECG example from your demo set. How do i control the speed of the live graph.
I want to makethe live graph a bit slow. Is there any setting or configuration to be modified to slow the graph. please let us know

Regards,
Aditya

1 vote
1k views

I created demo project using SurfaceMeshRenderableSeries3D but there is bugs or glitch. I have click listener.

image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (value == 0) {
layout.setVisibility(View.GONE);
value = 1;
} else {
value = 0;
layout.setVisibility(View.VISIBLE);
}
}
});

Above is basic GONE and VISIBLE logic, when i click image first time layout view is gone and SciChartSurface3D get full screen below is xml code.

<LinearLayout
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:orientation="vertical">

      <ImageView
          android:id="@+id/image"
          android:src="@mipmap/ic_launcher_round"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"/>

      <LinearLayout
          android:background="@color/design_default_color_secondary_variant"
          android:visibility="visible"
          android:orientation="vertical"
          android:id="@+id/layout"
          android:layout_width="match_parent"
          android:layout_height="100dp"/>

      <com.scichart.charting3d.visuals.SciChartSurface3D
          android:id="@+id/chart3d"
          android:layout_width="match_parent"
          android:layout_height="match_parent" />

   </LinearLayout>

My issues is when i click image the Scichart is getting full but with some black screen glitch, I attach before and after click event images.

Thanks in advance i am waiting for your answer.

0 votes
0 answers
1k views

Attempt to invoke interface method ‘com.scichart.data.model.IRange com.scichart.charting.visuals.axes.IAxisCore.getVisibleRange()’ on a null object reference

Getting above error while testing tooltip in 3DChart .First time tooltip work but second time after added new data in 3DChart tooltip crash.

0 votes
2k views

We are using single SurfaceMeshRenderableSeries3D chart and added multidata on condition click event but issue is sometime data is loaded or sometime not. So my question is how to refresh 3D chart after added new data ?

0 votes
5k views

Hi.
I have a line chart where i add data continuously from different sensors.
The code looks like this

protected open fun setupChart() {
    surface = requireView().findViewById(R.id.sciChartId)
    xAxis = NumericAxis(context).apply {
        autoRange = AutoRange.Always
        drawMajorGridLines = false
        drawMajorBands = false
        drawMinorGridLines = false
    }
    yAxis = NumericAxis(context).apply {

        drawMajorGridLines = false
        drawMajorBands = false
        drawMinorGridLines = false
        axisAlignment = AxisAlignment.Left
        // axisId ="First id"
    }
    dataSeries1 = XyDataSeries(Double::class.javaObjectType, Double::class.javaObjectType).apply {
        seriesName = "Line A"
        acceptsUnsortedData = true
    }

    val line1Color = Color.BLACK // ColorUtil.argb(0xFF, 0xFF, 0xFF, 0x00)

    val line1 = FastLineRenderableSeries().apply {
        strokeStyle = SolidPenStyle(line1Color, true, 1F, null)
        dataSeries = dataSeries1
        // yAxisId = "SecondId"
    }

    val legendModifier = LegendModifier(context).apply {
        setLegendPosition(Gravity.TOP or Gravity.START, 16)
        setOrientation(Orientation.VERTICAL)
        setSourceMode(SourceMode.AllSeries)
    }
    series.add(line1)

    UpdateSuspender.using(surface) {
        surface.xAxes.add(xAxis)
        surface.yAxes.add(yAxis)
        // surface.yAxes.add(yAxisTwo)
        surface.renderableSeries.addAll(series)
        surface.chartModifiers.add(legendModifier)
        surface.setBackgroundColor(Color.WHITE)

        series.forEach {
            AnimationsHelper.createAnimator(
                it,
                SweepXyTransformation(XyRenderPassData::class.java),
                3000,
                350,
                DecelerateInterpolator(),
                FloatEvaluator(),
                0f,
                1f
            ).start()
        }
    }

    addXAxisDragModifier()
    addZoomPanModifier()
    addZoomExtentModifier()
    addPinchZoom()
    surface.zoomExtents()
}

And the code adding data looks like this

dataSeries1.append(value, someOtherValue)

I understand that zooming is not possible when you set AutoRange to Always.
However i have not seen any working example where zooming is enabled at the same time as you add data continually.
Is it possible to zoom at all with real time without setting autoRange and if yes can you refer to any working example you have

  • Arbon Vata asked 2 years ago
  • last active 2 years ago
0 votes
2k views

thank you for answer !

Additional questions
image is attached

q1. last data only marker
q2. vertical dotted line (with rolloverModifier)

0 votes
2k views

Hi team,
Im using scicharts inside recyclerview and for some reasons im getting out of memory exception while loading or scrolling through the list.I’m not getting the issue everytime the page loads though.Is there something to do with optimization. The sample size to load the charts are high actually

0 votes
1k views

q1. How do I change the rollovermodifier’s vertical line to a dotted line?rolloverModifier.getVerticalLinePaint().setStyle(Paint.Style.STROKE);This source doesn’t seem to work

q2. I wonder how to display markers only on the last data of the line chart.

q3. I am wondering how to make the background transparent, how to make the grid transparent on the background.

0 votes
2k views

Hi team,

In my app,i’m using a custom rollover modifier as tool tip.I am representing y axis value (numerical value) in tooltip.I would like to have decimal places upto 3 digits in tooltip.do you have any suggestion to how i could achieve this. i’m attaching current screenshot along with this question.

Thanks
Vinu Gilbert

0 votes
8k views

Hello,

I am currently working on an DateTimeAxis where I am trying to display the labels in two hours intervals. So far it is working well but I have noticed when working with different timezones , if the timezone is odd, the labels display only odd numbers. When the timezone is even however the labels are even as well (eg. get-4 displays labels such as 2pm 4pm 6pm 8pm while gmt-7 displays 1pm 3pm 5pm 7pm)
I have played around with hours and dates to try to dynamically adjust the min and max visible ranges depending on if the current time is even or odd but that doesn’t affect at all the labels even after providing the major deltas and range.

does anyone know how to fix this issue? I want even labels regardless of the situation.

  • papa diaw asked 2 years ago
  • last active 2 years ago
0 votes
2k views

Hello,

I’m probably missing something obvious, but how can I change the font/colors of JUST the scichart legend (not axes labels or other text) in Android.

Thank you.

  • C Bolton asked 2 years ago
  • last active 2 years ago
0 votes
8k views

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.

0 votes
5k views

Hello Friends ,

   Sync two Chart in Android Bottom chart can be change on top chart touch

We are looking a solution where we want show two chart at Top and Bottom in Android Screen.based on Top chart changed by gesture /finger touch should be expend/shrink like zoom in and out bottom chart

Assume at top chart data range has between 0 to 3,00,000 , I want to capture in bottom chart only selected/touched part in with expanded form.

I have attached below screen shot which may be helpful.

Solution can be like this but not able to get code for this implementation

https://blog.scichart.com/content/images/2021/06/Navigate-ECG-strip-with-Pocket-ECM.gif

https://blog.scichart.com/android-app-to-view-long-term-ecg-signals/

I appreciate any help regarding this issue.

0 votes
5k views

Hello,

As you have already the examples of the EEG -50 channel, Is it possible to set the sensitivity factor for the channels to show the graph.
Basically, this will set the amplitude based on the frequency variation example 7micro volts/millimeter (7microvolts/mm) for each channel. Is there any way we can do it using Scichart, please let us know.

Appreciate your help

Regards,
Aditya

0 votes
8k views

Hello Friends,

I'm looking a solution where i can change Y-Axis range in between (0.1,0.2,0.4,0.6,0.8,1.0) .

I appreciate any help for above question

Thanks
Vasim

0 votes
2k views

When I work with the 2D Android Heatmap Chart, I want to draw a frame on the borders of the cells. Is this possible?

Thanks already for your help.

0 votes
2k views

Hi

I have added 24 Line graphs for EEG. Now I want to display the name of each channels against each graph. I am using Y steeped graph which you are using for Vital signs display in example code. Can you please let me know how to t to display the name of each channels against each graph

Best Regards,
Aditya

0 votes
2k views

Hi,

Can you please tell me how to show an annotation(extends at BoxAnnotation(x1, y1, 2, y2)) that starts at a certain point(x1, y1) and ends at the end of the chart. That is, the starting point (x1) is known, and the end point (x2) at the very end of the surface (graph)?
Thanks in advance.

Regards,
Batyr

0 votes
2k views

editable box annotation

Hi,

Can you please tell me how to change selection points of annotation?

Thanks in advance.

Regards,
Batyr

0 votes
2k views

We are adding 24 channel data Live graph using Scichart Example of Vital sign monitor. We are using VitalSignsMonitorShowcaseFragment.java example.

To show the live graph, do we need to accumulate the data for 50 point or so. I see in the code they are accumulating?

Is it necessary for the accumulation, please let us know

protected void initExample(ExampleVitalSignsMonitorFragmentBinding binding) {
    final DefaultVitalSignsDataProvider dataProvider = new DefaultVitalSignsDataProvider(getActivity());

    setUpChart(dataProvider);

    dataProvider.getData().buffer(50, TimeUnit.MILLISECONDS).doOnNext(ecgData -> {
        if(ecgData.isEmpty()) return;

        dataBatch.updateData(ecgData);

        UpdateSuspender.using(binding.surface, () -> {
            final DoubleValues xValues = dataBatch.xValues;

            ecgDataSeries.append(xValues, dataBatch.ecgHeartRateValuesA);
            ecgSweepDataSeries.append(xValues, dataBatch.ecgHeartRateValuesB);

            bloodPressureDataSeries.append(xValues, dataBatch.bloodPressureValuesA);
            bloodPressureSweepDataSeries.append(xValues, dataBatch.bloodPressureValuesB);

            bloodOxygenationDataSeries.append(xValues, dataBatch.bloodOxygenationA);
            bloodOxygenationSweepDataSeries.append(xValues, dataBatch.bloodOxygenationB);

            bloodVolumeDataSeries.append(xValues, dataBatch.bloodVolumeValuesA);
            bloodVolumeSweepDataSeries.append(xValues, dataBatch.bloodVolumeValuesB);

            final VitalSignsData lastVitalSignsData = dataBatch.lastVitalSignsData;
            final double xValue = lastVitalSignsData.xValue;

            lastEcgSweepDataSeries.append(xValue, lastVitalSignsData.ecgHeartRate);
            lastBloodPressureDataSeries.append(xValue, lastVitalSignsData.bloodPressure);
            lastBloodOxygenationSweepDataSeries.append(xValue, lastVitalSignsData.bloodOxygenation);
            lastBloodVolumeDataSeries.append(xValue, lastVitalSignsData.bloodVolume);
        });
    }).compose(bindToLifecycle()).subscribe();

    updateIndicators(0);
    Observable.interval(0, 1, TimeUnit.SECONDS, AndroidSchedulers.mainThread())
            .doOnNext(this::updateIndicators)
            .compose(bindToLifecycle()).subscribe();
}
0 votes
0 answers
2k views

I’ve recently found out that for some particular charts ,the series is not completely visible for top and bottom most parts of the chart.I need to drag the axis to see those portions.do you any suggestions for this issue.I’ll attach some ss.

Thanks in Advance

0 votes
2k views

Hi, I’ve trying to run the charts in emulator and it works fine with recyclerview ,but when i try to render chart in a fragment it doesn’t shows.The same fragment render charts in device and issue with emulator.I’m using geny motion. Thanks in Advance

0 votes
2k views

Hi,

Can you please tell me do you have tool like https://www.scichart.com/documentation/win/current/webframe.html#Fibonacci%20Retracement%20Drawing%20Tool.html
on Android?
If not, please give me a sample code on how to implement this with scichart.
Thanks in advance.

Regards,
Batyr

0 votes
2k views

Hi,

I,ve added ZoomExtentsModifier(), PinchZoomModifier() to the chart modifier.I want these modifiers on Xaxis only not on YAxis.Is possible to remove these modifiers on one axis.My requirement is that, during pinchzoom yaxis value needs to be constant

0 votes
2k views

Hi, I’ve been working on recyclerview with scichart.The problem i’m facing is that sometimes,when you come back from other screens the charts is not loading eventhough the other data in the list are showing.The list is placed inside a view pager .This issue is not consistant sometimes it shows the graph sometimes it won’t .The exception i’m getting are

java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child’s parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:5260)
at android.view.ViewGroup.addView(ViewGroup.java:5089)

2021-08-17 14:50:52.639 15073-29533/com.fascilityconnex.voicemobile E/SciChart Rendering Errors: SciChartSurface has no XAxes. Please ensure SciChartSurface.XAxis is set, or SciChartSurface.XAxes has at least one axis
2021-08-17 14:50:52.641 15073-29531/com.fascilityconnex.voicemobile E/Exception: null
java.lang.UnsupportedOperationException: AxisCollection.getAxisById(‘DefaultAxisId’) returned more than one axis with the ID=DefaultAxisId. Please check you have assigned correct axis Ids when you have multiple axes in SciChart
at com.scichart.charting.model.AxisCollection.getAxisById(SourceFile:10)

0 votes
5k views

I would like to add scroll listener on x axis title. Is it possible to add scroll to axis title

0 votes
2k views

When I open the activity with the chart , I see a black screen. And there is no graph displayed.
I have a trial license key which is valid.

Here is my full code:
xml file:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/chart_layout"
android:orientation="vertical">

Activity:

public class ECGMonitorFragment extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {
        com.scichart.charting.visuals.SciChartSurface.setRuntimeLicenseKey("");
    } catch(Exception e){

        Log.e("SciChart", "Error while accesing the license", e);
    }


    setContentView(R.layout.activity_ecgmonitor_fragment);



    // Create a SciChartSurface
    final SciChartSurface surface = new SciChartSurface(this);

    // Get a layout declared in "activity_main.xml" by id
    LinearLayout chartLayout = (LinearLayout) findViewById(R.id.chart_layout);

    // Add the SciChartSurface to the layout
    chartLayout.addView(surface);

    // Initialize the SciChartBuilder
    SciChartBuilder.init(this);

    // Obtain the SciChartBuilder instance
    final SciChartBuilder sciChartBuilder = SciChartBuilder.instance();

    // Create a numeric X axis
    final IAxis xAxis = sciChartBuilder.newNumericAxis()
            .withAxisTitle("X Axis Title")
            .withVisibleRange(-5, 15)
            .build();

    // Added in Tutorial #8 - two Y axes
    // Create a numeric axis, right-aligned
    final IAxis yAxisRight = sciChartBuilder.newNumericAxis()
            .withAxisTitle("Primary")
            // Assign a unique ID to the axis
            .withAxisId("primaryYAxis")
            .withAxisAlignment(AxisAlignment.Right)
            .build();

    // Create another numeric axis, left-aligned
    final IAxis yAxisLeft = sciChartBuilder.newNumericAxis()
            .withAxisTitle("Secondary")
            // Assign a unique ID to the axis
            .withAxisId("secondaryYAxis")
            .withAxisAlignment(AxisAlignment.Left)
            .withGrowBy(0.2,0.2)
            .build();

    // Add both Y axes to the YAxes collection of the surface
    Collections.addAll(surface.getYAxes(), yAxisLeft, yAxisRight);

    // Added in Tutorial #3
    // Add a bunch of interaction modifiers to a ModifierGroup
    ModifierGroup chartModifiers = sciChartBuilder.newModifierGroup()
            // Setting MotionEventsGroup
            .withMotionEventsGroup("SharedMotionEvents").withReceiveHandledEvents(true)
            .withPinchZoomModifier().build()
            .withZoomPanModifier().withReceiveHandledEvents(true).build()
            .withZoomExtentsModifier().withReceiveHandledEvents(true).build()
            .withXAxisDragModifier().withReceiveHandledEvents(true).withDragMode(AxisDragModifierBase.AxisDragMode.Scale).withClipModeX(ClipMode.None).build()
            .withYAxisDragModifier().withReceiveHandledEvents(true).withDragMode(AxisDragModifierBase.AxisDragMode.Pan).build()
            .build();

    // Add the X axis to the XAxes collection of the surface
    Collections.addAll(surface.getXAxes(), xAxis);

    // Add the interactions to the ChartModifiers collection of the surface
    Collections.addAll(surface.getChartModifiers(), chartModifiers);

    // Added in Tutorial #6 - FIFO (scrolling) series
    // Create a couple of DataSeries for numeric (Int, Double) data
    // Set FIFO capacity to 500 on DataSeries
    final int fifoCapacity = 500;

    final XyDataSeries lineData = sciChartBuilder.newXyDataSeries(Integer.class, Double.class)
            .withFifoCapacity(fifoCapacity)
            .build();
    final XyDataSeries scatterData = sciChartBuilder.newXyDataSeries(Integer.class, Double.class)
            .withFifoCapacity(fifoCapacity)
            .build();

    // Create and configure a line series
    final IRenderableSeries lineSeries = sciChartBuilder.newLineSeries()
            .withDataSeries(lineData)
            // Register on a particular Y axis using its ID
            .withYAxisId("primaryYAxis")
            .withStrokeStyle(ColorUtil.LightBlue, 2f, true)
            .build();

    // Create an Ellipse PointMarker for the Scatter Series
    EllipsePointMarker pointMarker = sciChartBuilder
            .newPointMarker(new EllipsePointMarker())
            .withFill(ColorUtil.LightBlue)
            .withStroke(ColorUtil.Green, 2f)
            .withSize(10)
            .build();

    // Create and configure a scatter series
    final IRenderableSeries scatterSeries = sciChartBuilder.newScatterSeries()
            .withDataSeries(scatterData)
            // Register on a particular Y axis using its ID
            .withYAxisId("primaryYAxis")
            .withPointMarker(pointMarker)
            .build();

    // Add a RenderableSeries onto the SciChartSurface
    surface.getRenderableSeries().add(scatterSeries);
    surface.getRenderableSeries().add(lineSeries);
    surface.zoomExtents();

    // Added in Tutorial #5
    // Create a LegendModifier and configure a chart legend
    ModifierGroup legendModifier = sciChartBuilder.newModifierGroup()
            .withLegendModifier()
            .withOrientation(Orientation.HORIZONTAL)
            .withPosition(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, 10)
            .build()
            .build();

    // Add the LegendModifier to the SciChartSurface
    surface.getChartModifiers().add(legendModifier);

    // Create and configure a CursorModifier
    ModifierGroup cursorModifier = sciChartBuilder.newModifierGroup()
            // Setting MotionEventsGroup
            .withMotionEventsGroup("SharedMotionEvents").withReceiveHandledEvents(true)
            .withCursorModifier().withShowTooltip(true).build()
            .build();

    // Add the CursorModifier to the SciChartSurface
    surface.getChartModifiers().add(cursorModifier);

    // Added in Tutorial #9 - one more SciChartSurface
    final SciChartSurface surface2 = new SciChartSurface(this);

    // Add the SciChartSurface to the layout
    chartLayout.addView(surface2);

    // Set layout parameters for both surfaces
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f);
    surface.setLayoutParams(layoutParams);
    surface2.setLayoutParams(layoutParams);

    // Create a numeric X axis
    final IAxis xAxis2 = sciChartBuilder.newNumericAxis()
            .withAxisTitle("X Axis Title")
            .withVisibleRange(-5, 15)
            .build();

    // Create a numeric axis
    final IAxis yAxisRight2 = sciChartBuilder.newNumericAxis()
            .withAxisTitle("Primary")
            .withAxisId("primaryYAxis")
            .withAxisAlignment(AxisAlignment.Right)
            .build();

    // Create another numeric axis
    final IAxis yAxisLeft2 = sciChartBuilder.newNumericAxis()
            .withAxisTitle("Secondary")
            .withAxisId("secondaryYAxis")
            .withAxisAlignment(AxisAlignment.Left)
            .withGrowBy(0.2, 0.2)
            .build();

    // Add the Y axis to the YAxes collection of the surface
    Collections.addAll(surface2.getYAxes(), yAxisLeft2, yAxisRight2);

    // Add the X axis to the XAxes collection of the surface
    Collections.addAll(surface2.getXAxes(), xAxis2);

    // Create and configure an area series
    final IRenderableSeries areaSeries = sciChartBuilder.newMountainSeries()
            .withDataSeries(scatterData)
            .withYAxisId("primaryYAxis")
            .withStrokeStyle(ColorUtil.LightBlue, 2f, true)
            .withAreaFillColor(ColorUtil.argb(ColorUtil.LightSteelBlue, 0.6f))
            .build();

    // Add the area series to the RenderableSeries collection of the surface
    Collections.addAll(surface2.getRenderableSeries(), areaSeries);

    // Create the second collection of chart modifiers
    ModifierGroup chartModifiers2 = sciChartBuilder.newModifierGroup()
            // Setting MotionEventsGroup
            .withMotionEventsGroup("SharedMotionEvents").withReceiveHandledEvents(true)
            .withZoomExtentsModifier().withReceiveHandledEvents(true).build()
            .withZoomPanModifier().withReceiveHandledEvents(true).build()
            .withPinchZoomModifier().withReceiveHandledEvents(true).build()
            .withCursorModifier().withReceiveHandledEvents(true).build()
            .build();

    // Add the interactions to the ChartModifiers collection of the surface
    Collections.addAll(surface2.getChartModifiers(), chartModifiers2);

    TimerTask updateDataTask = new TimerTask() {
        private int x = 0;

        @Override
        public void run() {
            UpdateSuspender.using(surface, new Runnable() {
                @Override
                public void run() {
                    lineData.append(x, Math.sin(x * 0.1));
                    scatterData.append(x, Math.cos(x * 0.1));

                    // Added in Tutorial #7
                    // Add an annotation every 100 data points
                    if(x%100 == 0) {
                        TextAnnotation marker = sciChartBuilder.newTextAnnotation()
                                // Register on a particular Y axis using its ID
                                .withYAxisId("primaryYAxis")
                                .withIsEditable(false)
                                .withText("N")
                                .withBackgroundColor(ColorUtil.Green)
                                .withX1(x)
                                .withY1(0.0)
                                .withVerticalAnchorPoint(VerticalAnchorPoint.Center)
                                .withHorizontalAnchorPoint(HorizontalAnchorPoint.Center)
                                .withFontStyle(20, ColorUtil.White)
                                .withZIndex(1)
                                .build();

                        surface.getAnnotations().add(marker);

                        // Remove one annotation from the beginning
                        // in the FIFO way
                        if(x > fifoCapacity){
                            surface.getAnnotations().remove(0);
                        }
                    }

                    // Zoom series to fit the viewport
                    surface.zoomExtents();
                    surface2.zoomExtents();
                    ++x;
                }
            });
        }
    };

    Timer timer = new Timer();

    long delay = 0;
    long interval = 10;
    timer.schedule(updateDataTask, delay, interval);

}

}

Showing 51 - 100 of 527 results

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies