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
0 answers
9k views

I noticed that there are two debugging perspectives in Eclipse that are set for Android development.

Why two?

What does DDMS perspective do that Debug perspective does not?

To clarify, I’m only interested in the diff comparison table, not the complete list of DDMS functions.

Session.StatusCallback cannot be resolved for type – Facebook API
Can’t debug via eclipse on the phone with Jelly Bean
What does the use of “.” Without an object in Android (or java)?
Launching TriggerIO Android ForgeInspector
Android Maven in Eclipse – creating an activity
I’m also curious to know why the people who developed DDMS didn’t add it to the Debug perspective, but chose to implement it as an independent perspective.

0 votes
0 answers
11k views

does anybody have binary option source code example?
i want to learn it

0 votes
7k views

Referring to the stacked column side by side example in the android examples collection, if someone clicks on a column/series in that chart, how could i identify which the of columns has been selected (usa, china, india, etc).

0 votes
0 answers
3k views

I realized that removing a series from a chart and adding the same series back again (instead of toggling visibility) breaks the modifiers for that series (e.g, rollover, legend). Why is that? Is toggling visibility the preferred way?

0 votes
7k views

I’ve attached example code where setting “majorTickLineLength” appears to have no effect on the length of the major tick lines. I’m trying to make them shorter than the default (half the length). How can I adjust the length of these tick lines?

0 votes
10k views

I am extending a PieSegmentLabelFormatterBase to format the segment label of a piechart. however I cannot find any information regarding how I can change its size. So my question is How can I change the font size of piechart labels?

0 votes
3k views

using android scichart with two surfaces vertically on the screen, that is one above the other, same width. I wish to match the width of the X axis on both. when the labels of the Y axis are formatted differently the X axis may change overall width. I suppose there could be two approaches,
1) fix or match the width of the X axis
2) fix or match the width of the Y axis labels

which is the simplest? and where can I learn more?

  • Van Malan asked 3 years ago
  • last active 3 years ago
0 votes
4k views

Hello,

I am wanting to “force” an axis label on a specific value. For example, right now in my datetime graph it always shows a “5PM” time on the axis regardless of the data. Instead, I would like to “anchor” the axis ticks on a different time value, like local Noon. We were able to do this in our previous charting solution, but I have not yet figured out how to do it with SciChart.

Thank you.

  • C Bolton asked 4 years ago
  • last active 4 years ago
0 votes
10k views

Hi,

I’d like to enable AnnotationCreationListener with a toggle button pressed down, and disable it with the button released. It’s different from the Android sample code in Create Annotation Dynamically. I have a few questions when I’m trying to code. I’m not sure if my approach is on the right track. Please advise, thanks.

// insert button listener
    insertAnnotationButton = findViewById(R.id.annotationInsertButton);
    insertAnnotationButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            // TODO: add chartmodifier/annotationCreationModifier when button pressed down
            if (insertAnnotationButton.isChecked()) {
                annotationCreationModifier.setAnnotationType(???); // how to set type to vertical line annotation?
                DefaultAnnotationFactory annotationFactory = new DefaultAnnotationFactory();
                annotationFactory.setFactoryForAnnotationType(DefaultAnnotationFactory.VERTICAL_LINE_ANNOTATION, new IAnnotationFactory() {
                    @NonNull
                    @Override
                    public IAnnotation createAnnotation(@NonNull ISciChartSurface parentSurface, int annotationType) {
                        return sciChartBuilder.newVerticalLineAnnotation().withIsEditable(true).withStroke(1, White).withVerticalGravity(Gravity.FILL_VERTICAL).build();
                    }
                });
                annotationCreationModifier.setAnnotationFactory(annotationFactory);
                annotationCreationModifier.setAnnotationCreationListener(new OnAnnotationCreatedListener() {
                    @Override
                    public void onAnnotationCreated(IAnnotation iAnnotation) {
                        // how to get X coordinate of the annotation and update my annotation variable

                    }
                });
                ecmSurface.getChartModifiers().add(sciChartBuilder.newModifierGroup().withModifier(annotationCreationModifier)..build());
            } else {
                // how to remove annotationCreationModifier from ChartModifiers?
                ecmSurface.getChartModifiers().remove(???);
            }
        }
    });
  • Gang Xu asked 4 years ago
  • last active 4 years ago
0 votes
7k views

Hello,

I’m trying to figure out how to apply a consistent gradient to the areas underneath my line charts. For example, if I have chart with Y values 0-10, I might want the area corresponding to 0 to be white, and 10 to be black, regardless of what values are currently panned or zoomed onto the screen. From what I have seen so far, SciChart gradients are based on the current screen values, so if I were zoomed into an area that was only 0-5, it would should a white to black gradient (not what I want), whereas I need a white to grey variant (reserving the black for 10’s). I hope that makes sense.

Thank you.

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

How to move date labels to the middle of the day ?

val xAxis = DateAxis(applicationContext).apply {
        drawLabels = true
        autoFitMarginalLabels = true
        axisTitle = "X Date Axis"
        axisAlignment = AxisAlignment.Bottom
        drawMajorBands = false
        drawMinorGridLines = false
        drawMajorGridLines = true
    }
0 votes
3k views

HI,

I’m trying to go through the “Your First App” tutorials

I’ve completed the first one:
“Creating your First SciChart Android App – Part 1”:
https://www.scichart.com/documentation/android/current/webframe.html#Creating%20your%20First%20SciChart%20Android%20App%20-%20Part%201.html

which seems fine.

I then go to
“Creating your First SciChart Android App – Part 2”:
https://www.scichart.com/documentation/android/current/webframe.html#Creating%20your%20First%20SciChart%20Android%20App%20-%20Part%202.html

Unfortunately, I don’t see the SciChart items in the Palette when I scroll down to the Custom section.

Could you point to how I can make SciChart available please?

Screen shots attached.

Thank you,
Ed

  • Ed Sykes asked 4 years ago
  • last active 4 years ago
0 votes
11k views

Hi,

I just downloaded SciChart for Android. Trying to get the Example to work.

I’ve put my trial key in SciChartApp.java and tried to run.

Here are the errors (screen shot attached).

Thank you,
Ed

  • Ed Sykes asked 4 years ago
  • last active 4 years ago
0 votes
14k views

I have a few problems that I’m trying to address with y-axis labelling.

  1. I am including a y-axis on the left side of my graph but want the text of the labels to be right-aligned. Each label uses two lines of text. How can I do that?
  2. I want the margin of the text to be a specific width so that I can line up the y-axis of multiple scichart surfaces that are stacked vertically. How can I set each of my scichart surfaces to use a particular margin for the y-axis labelling?
  3. The y-axis label text will wrap when I don’t want it to (see attached image — The text of the label should be “1m \n Left” and I am currently seeing “1m \n Lef \n t”). How do I turn off the wrapping of text on the y-axis?

———-

This is how I am currently implementing the y-axis:

NumericAxis(context).apply {
    drawLabels = true
    axisAlignment = AxisAlignment.Left
    this.labelProvider = labelProvider
    this.tickProvider = tickProvider
    drawMajorBands = false
    drawMajorTicks = false
    drawMinorTicks = false
    drawMajorGridLines = false
    drawMinorGridLines = false
    isLabelCullingEnabled = false
    visibleRange = DoubleRange(
            dataRange.first,
            dataRange.second
    )
    autoRange = AutoRange.Never
    tickLabelStyle = FontStyle(
            TypefaceManager.obtainTypeface(context, CustomTypeface.PROXIMA_NOVA_REG),
            context.resources.getDimension(R.dimen.results_screen_graph_labels_text_size),
            Color.LTGRAY
    )
}
0 votes
6k views

Android
App version 3.1.1.4423

I am able to sync two charts and receive events between both charts.

However, I wanted to remove the shared y-axis panning between the charts.
I was able to get this working by setting the “withReceiveHandledEvents(false)” linked to the motion event group and setting the “.withYAxisDragModifier().withReceiveHandledEvents(false)”.

However, the current problem being faced, is that, the cursor is now no longer synced between the two charts as if I had “withReceiveHandledEvents(false)” on the motion event group.

I tried using the cursor modifier group, but this did not provide a syncing cursor between the charts.

Is there a way to sync the cursor between the charts without having the y-axis panning synced as well?

0 votes
7k views

Hello,

I get data from reading an URL so I save them (prepared) to a Arraylist (type PieSegment). How can I add the PieSegments from the Arraylist with (for example a loop) to my Piechart?

BR and thank you very much.
Marco

0 votes
4k views

Hi everyone,

I’m working on a 2D chart on Android that requires the distance between major axes to be exactly 5 millimetres. How do I configure the major axis delta/ticks or resize the chart to meet my need?

Thank you.

0 votes
10k views

Hello,

I want to use the MultiplePieDonutChart. Like in the example, I want to have a touch tooltip.
I tried it with that code:

LinearLayout chartLayout = (LinearLayout) root.findViewById(R.id.chart_layout);
SciChartLegend legend = root.findViewById(R.id.pieChartLegend);

    chartLayout.addView(surface);

    SciChartBuilder.init(MainMenu.getActivity());

    final SciChartBuilder sciChartBuilder = SciChartBuilder.instance();

    final IPieRenderableSeries pieSeries = sciChartBuilder.newPieSeries().withSeriesName("HowPeopleTravel").withSegments(
            sciChartBuilder.newPieSegment().withValue(34).withTitle("Ecologic").withRadialGradientColors(0xff84BC3D, 0xff5B8829).build(),
            sciChartBuilder.newPieSegment().withValue(34.4).withTitle("Municipal").withRadialGradientColors(0xffe04a2f, 0xffB7161B).build(),
            sciChartBuilder.newPieSegment().withValue(31.6).withTitle("Personal").withRadialGradientColors(0xff4AB6C1, 0xff2182AD).build()
    ).build();
    final IPieRenderableSeries donutSeries = sciChartBuilder.newDonutSeries().withSeriesName("DetailedGroup").withSegments(
            sciChartBuilder.newPieSegment().withValue(28.8).withTitle("Walking").withRadialGradientColors(0xff84BC3D, 0xff5B8829).build(),
            sciChartBuilder.newPieSegment().withValue(5.2).withTitle("Bicycle").withRadialGradientColors(0xff84BC3D, 0xff5B8829).build(),
            sciChartBuilder.newPieSegment().withValue(12.3).withTitle("Metro").withRadialGradientColors(0xffe04a2f, 0xffB7161B).build(),
            sciChartBuilder.newPieSegment().withValue(3.5).withTitle("Tram").withRadialGradientColors(0xffe04a2f, 0xffB7161B).build(),
            sciChartBuilder.newPieSegment().withValue(5.9).withTitle("Rail").withRadialGradientColors(0xffe04a2f, 0xffB7161B).build(),
            sciChartBuilder.newPieSegment().withValue(9.7).withTitle("Bus").withRadialGradientColors(0xffe04a2f, 0xffB7161B).build(),
            sciChartBuilder.newPieSegment().withValue(3.0).withTitle("Taxi").withRadialGradientColors(0xffe04a2f, 0xffB7161B).build(),
            sciChartBuilder.newPieSegment().withValue(23.2).withTitle("Car").withRadialGradientColors(0xff4AB6C1, 0xff2182AD).build(),
            sciChartBuilder.newPieSegment().withValue(3.1).withTitle("Motorcycle").withRadialGradientColors(0xff4AB6C1, 0xff2182AD).build(),
            sciChartBuilder.newPieSegment().withValue(5.3).withTitle("Other").withRadialGradientColors(0xff4AB6C1, 0xff2182AD).build()
    ).build();

    Collections.addAll(surface.getRenderableSeries(), pieSeries, donutSeries);
    Collections.addAll(surface.getChartModifiers(), sciChartBuilder.newLegendModifier(legend).withShowCheckBoxes(false).withSourceSeries(pieSeries).build(), new PieChartTooltipModifier());

But if I touch on the chart I didn’t get the tooltip. As you see I have nearly copy all the code of the Example but I do not work. Where is my fault?

0 votes
11k views

Hi,

I have a list of 12 items, but at the start I only want to see the last 6 items on the chart (stacked column chart). I want to be able to scroll / drag to reveal the first part of the list. I use the index of the list for the x-axis, so the list has indexes with range from [0, 11]

I’m having some weird behaviour implementing this.
When the data is loaded, i see the complete bars:

creenshot 2020-09-18 at 11.04.14.png

but when I start to scroll, i’m never able to reveal the complete bars anymore:
![Screenshot 2020-09-18 at 11.04.40.png][2]
![Screenshot 2020-09-18 at 11.04.59.png][3]

When i start scrolling to the end (although the chart is already at the end), the UI jumps and only shows half a bar. Also when i scroll to the beginning, it only shows half a bar.

How can I make sure I always see the complete bars?

This is the code, specific to the x axis & the scrolling:

val xAxis = sciChartBuilder.newNumericAxis()
            .withDrawMajorBands(false)
            .withDrawMajorGridLines(false)
            .withDrawMinorGridLines(false)
            .withDrawMinorTicks(false)
            .withMajorDelta(1.0)
            .withMinorDelta(0.2)
            .withAutoTicks(false)
            .withVisibleRange(5.5, 11.5)
            .build()

using half values for the range seems to be the only way I can see the full bars. Once I start scrolling I only see half bars at the start & end

val surfaceChartModifiers: ChartModifierCollection = chart.chartModifiers
val dragModifier = XAxisDragModifier()
dragModifier.dragMode = AxisDragModifierBase.AxisDragMode.Pan
surfaceChartModifiers.add(dragModifier)

val zoomPanModifier = ZoomPanModifier()
zoomPanModifier.clipModeX = ClipMode.ClipAtExtents
zoomPanModifier.direction = Direction2D.XDirection
zoomPanModifier.zoomExtentsY = false
surfaceChartModifiers.add(zoomPanModifier)
0 votes
4k views

Hi,

I figure there is probably a way to do this, but I haven’t figured it out yet.

I would like remove (or maybe just make transparent?) my chart areas top and right borders, leaving the lefthand and bottom alone. I’ve attached an image with the borders circled that I would like to remove to make it clear.

Thank you.

  • C Bolton asked 4 years ago
  • last active 4 years ago
0 votes
7k views

I used box annotation like pic
in a boxAnnotation I used

.withIsEditable(true)
.withPosition(1,-2, 0, 2)
.withBackgroundDrawableId(R.drawable.example_box_annotation_background_4)
.withResizingGrip(customIResizingGrip)
.withAnnotationDragListener(customIAnnotationSelectionDrawable)
.withResizeDirections(Direction2D.XDirection)
.withDragDirections(Direction2D.XDirection)
.build();

and i made a 2 box like pic

i use box for drag one side to make a box big or small

the first box which is left doesn’t move anywhere.
it just can only drag that i want
but the second box, the box moves when i drag after first touch
the left box never moves on but right box moves first drags
just move first time not sometimes

am i wrong something?

  • Justin Lee asked 4 years ago
  • last active 4 years ago
0 votes
4k views

Hello,

I’m trying to add custom text to a rollover cursor that is dependent on its X and Y Values.

For instance, if the Y Value is 1, but the X value (date) is old, it should say “1 ft Observed”, but if it the date is in the future, it should say “1 ft Predicted”. I can format the cursor label via NumericLabelProvider, but it only provides me the Y value, and I need the corresponding X value as well to properly format the cursor label.

    class NumericLabelProviderEx() : NumericLabelProvider() {
        override fun formatCursorLabel(doubleValue: Double): CharSequence {
            val formatString = "%.1f %s\n%s"
            // Any way to get corresponding X value for this so I can change "Observed" to "Predicted" if this point is in the future?
            val s = String.format(formatString, doubleValue, "ft", "Observed")
            return s
        }
    }

    yAxis.setLabelProvider(NumericLabelProviderEx())

Is there an alternative approach to accomplish this within SciChart?

Thank you.

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

Hello.

I’m trying to modifying Audio Analyzer Example.

This is scenario.

  1. Read wav file
  2. Calculate FFT (for all sample data of wav file)
  3. Display FFT result to FFT & Spectrogram chart.

The point is this : read all data at once and calulate FFT for dispaly in chart.

I already have FFT result with re[] and im[] type arrays.

  1. When I setting up X,Y axis of FFT chart, following code applied.
    Q. x,y axis and value setup is correct?

                // prepare fft input (dataF is float type sample data of wav file)
                double[] re = new double[dataF.length];
                double[] im = new double[dataF.length];
                double[] mag = new double[dataF.length];
                for(int ii=0; ii<dataF.length; ii++) {
                    re[ii] = (double)dataF[ii];
                    im[ii] = 0.0d;
                }
    
                FFTf.transform(re, im);  // using Bluestein DFT algorithm.
    
                for(int nn=0; nn < re.length; nn++) {
                    mag[nn] = Math.sqrt(re[nn] * re[nn] + im[nn] * im[nn]);
                    if(nn <= 10 || re.length - 10 <= nn)
                }
    
                // setup fft and x,y values
                for(int l=0; l < re.length/20; l++) {
                    fftDS.append((1.0*l*sampleRate/re.length), Math.sqrt(re[l] * re[l] + im[l] * im[l]));
                }
    
  2. When I setting up X,Y axis of Spectrogram chart, following code applied.
    Q. x,y axis and value setup is correct?

                fftCount = dataProvider.getAudioDataByteSize() / 4096;
                spectrogramDS = new UniformHeatmapDataSeries<>(Long.class, Long.class, Double.class, re.length/20, fftCount);
                fftOffsetValueCount = (re.length/20)*fftCount - (re.length/20);
                spectrogramValues = new DoubleValues((re.length/20)*fftCount);
                spectrogramValues.setSize((re.length/20)*fftCount);
    
                // update spectrogram chart data
                for(int jj=0; jj < fftCount; jj += 4096) {
                    double[] spectrogramItems = spectrogramValues.getItemsArray();
                    double[] fftItems = getFrom(mag, 4096, jj);
    
                    System.arraycopy(spectrogramItems, re.length/20, spectrogramItems, 0, fftOffsetValueCount);
                    System.arraycopy(fftItems, 0, spectrogramItems, fftOffsetValueCount, re.length/20);
    
                    spectrogramDS.updateZValues(spectrogramValues);
                }
    

FFT chart is working but Spectrogram is not.

Thank you for your help!

0 votes
4k views

How do I know when user edited the text on TextAnnoation so the app can save it?
How to do the same for https://www.scichart.com/questions/wpf/get-textannotation-text-after-user-editing for Android and iOS version of SciChart?

0 votes
10k views

Hello,

I would try out the examples with my trial but I got this error:

error: package io.reactivex does not exist import
io.reactivex.Observable;

I hope you can help me. Thank you.

BR
Marco

PS.: I did everything like in the Tutorial

0 votes
7k views

want to show error marker in line series if data point is bad (isGoodValue=false). how to set metadata in android series

0 votes
10k views

Hello,

I’m wanting to switch to SciChart from a previous charting library. One neat thing that our previous library did that I cannot figure out how to do in SciChart is change the interaction between tooltips/rollover and panning.

What I would like to do is Pan/Drag the chart on short tap events, and do a rollover or tooltip cursor on long tap events. By default it looks like I get rollover and panning together on any tap event, which is not ideal behavior for my apps. Depending on the tap event type, I would like to do just one or the other, not both. How can I do something similar with SciChart?

Thank you,

  • C Bolton asked 4 years ago
  • last active 4 years ago
0 votes
13k views

i follow this way to update an exist candle

stockPrices.update(stockPrices.getCount() – 1, priceBar.getOpen(), priceBar.getHigh(), priceBar.getLow(), priceBar.getClose());

it work well but not so smooth, SciChart have any other way or trick to do this ?
Thank you

  • tran hai asked 4 years ago
  • last active 4 years ago
0 votes
7k views

I’m using boxAnnotation Object with some properties

I use
.withDragDirections(Direction2D.XDirection)
.withResizeDirections(Direction2D.XDirection)
for resize and drag only x direction

It looks like drag and resize only x direction but the box resize y direction a little bit

I do not use any special properties using boxAnnotation

use of course .withIsEditable for editing
.withPosition, .withBackgroundDrawableId
that’ it

and I also wonder when i declare new CustomIResizingGrip object with new Canvas

why withDragDirections, withResizeDirections dont work?

  • cy bang asked 4 years ago
  • last active 4 years ago
0 votes
8k views

i wanna use vertical line annotation in box annotation that only one edge moves to drag like using ‘chart drag area to zoom’

I checked about custom annotation and there’s features said ‘common features of annotations’ but they don’t have any features l’m looking for

i put pictures for understanding.

there are box annotation on a graph and I want to move line to drag and box is going to smaller or larger

and i also want the other edge is fixed, it can not be dragged

do you guys have any tips for me?

  • cy bang asked 4 years ago
  • last active 4 years ago
0 votes
4k views

Hi, I have a question for clearing data series.

Unlike XyDataSeriess object, when I call clear() method on UniformHeatmapDataSeries,

following exception occured.

[error message]
java.lang.UnsupportedOperationException: This operation isn’t supported by this type of data series
at com.scichart.charting.model.dataSeries.UniformHeatmapDataSeries.clear(SourceFile:328)
at com.scichart.charting.model.dataSeries.DataSeriesCore.clear(SourceFile:66)

How to clear UniformHeatmapDataSeries object data?

Thanks a lot.

0 votes
0 answers
6k views

Hi,

I am new to Xamarin and looking for possibilities how to use Xamarin.Android (later Xamarin.iOS too) chart in Xamarin.Forms shared code.
I know SciChart working on it, but at this moment I need solution.

I have alredy read about these:
– Custom Renderers (https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer)
– Native Views (https://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/native-views)

Which is better?
Does anybody has an exact example or documentation to how to use it with SciChart?

Bests,
Roland

0 votes
4k views

Here my code, i try to draw a chart with candle stick and horizontal line with real time data update, but HorizontalLineAnnotation never show, here my code:
final CategoryDateAxis xAxis = sciChartBuilder.newCategoryDateAxis()
.withGrowBy(0, 0.01)
.withVisibleRange(80, 102)
.build();
NumericAxis yAxis = sciChartBuilder.newNumericAxis()
.withAxisId(PRICES)
.withTextFormatting(“0.00”)
.withAutoRangeMode(AutoRange.Always)
.build();

    Collections.addAll(surface.getXAxes(), xAxis);
    Collections.addAll(surface.getYAxes(), yAxis);

               FastCandlestickRenderableSeries rSeries =  sciChartBuilder.newCandlestickSeries().withDataSeries(stockPrices).withYAxisId(PRICES)
                       .build();

                HorizontalLineAnnotation horizontalLine = sciChartBuilder.newHorizontalLineAnnotation()
                        .withPosition(5d, 3.2d) // i have try to change this but wont work
                        .withStroke(2, ColorUtil.Orange)
                        .withHorizontalGravity(Gravity.RIGHT)
                        .withIsEditable(true)
                        .build();
    ohlcAxisMarker = sciChartBuilder.newAxisMarkerAnnotation().withY1(1d).withBackgroundColor(0xFF33DD33).withYAxisId(PRICES).build();

                UpdateSuspender.using(surface, new Runnable() {
                    @Override
                    public void run() {
                        Collections.addAll(surface.getAnnotations(), ohlcAxisMarker, horizontalLine);
                        Collections.addAll(surface.getRenderableSeries(), rSeries);
                        Collections.addAll(surface.getChartModifiers(), sciChartBuilder.newModifierGroupWithDefaultModifiers().build());
                    }
                });
  • tran hai asked 4 years ago
  • last active 4 years ago
0 votes
7k views

I’m not sure what is going on, but I am consistently getting an error about my trial license key not being valid (it has 28 days left)

Error msg: “Sorry! You have not set a License Key. You can request a free trial key from http://www.scichart.com...”

Code (trial key partially snipped):

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)

    // Set this code once in MainActivity or application startup
    SciChartSurface.setRuntimeLicenseKey("w2q0iyS8UeR2HKF...uqUbxqjprSIvXJPibCSl1g6ag==")

    // Get the scichartsurface
    val surface = findViewById<com.scichart.charting.visuals.SciChartSurface>(R.id.id_scichartsurface)
    // Initialize the SciChartBuilder
    SciChartBuilder.init(this)
    // Obtain the SciChartBuilder instance
    val sciChartBuilder = SciChartBuilder.instance()
    // Create a numeric X axis
    val xAxis: IAxis = sciChartBuilder.newNumericAxis()
        .withAxisTitle("X Axis Title")
        .withVisibleRange(-5.0, 15.0)
        .build()
    // Create a numeric Y axis
    val yAxis: IAxis = sciChartBuilder.newNumericAxis()
        .withAxisTitle("Y Axis Title").withVisibleRange(0.0, 100.0).build()
    // Create a TextAnnotation and specify the inscription and position for it
    val textAnnotation = sciChartBuilder.newTextAnnotation()
        .withX1(5.0)
        .withY1(55.0)
        .withText("Hello World!")
        .withHorizontalAnchorPoint(HorizontalAnchorPoint.Center)
        .withVerticalAnchorPoint(VerticalAnchorPoint.Center)
        .withFontStyle(20f, ColorUtil.White)
        .build()
    // Create interactivity modifiers
    val chartModifiers = sciChartBuilder.newModifierGroup()
        .withPinchZoomModifier().withReceiveHandledEvents(true).build()
        .withZoomPanModifier().withReceiveHandledEvents(true).build()
        .build()
    // Add the Y axis to the YAxes collection of the surface
    Collections.addAll(surface.yAxes, yAxis)
    // Add the X axis to the XAxes collection of the surface
    Collections.addAll(surface.xAxes, xAxis)
    // Add the annotation to the Annotations collection of the surface
    Collections.addAll(surface.annotations, textAnnotation)
    // Add the interactions to the ChartModifiers collection of the surface
    Collections.addAll(surface.chartModifiers, chartModifiers)
}

Any assistance appreciated. Thank you.

  • C Bolton asked 4 years ago
  • last active 3 years ago
0 votes
4k views

Hi, I’m modifying AudioAnalyzer chart example.

  1. I want to know that how to display time value on XAxis in this example.

In audio stream chart example, xData value store 0 to 2048 value for each onNext.

like this,

final long[] itemsArray = audioData.xData.getItemsArray();
for (int i = 0; i < minBufferSize; i++) {
itemsArray[i] = time++;
}

I want to display time value like “mm:ss” format on XAxis.

What kinds of data should be stored in itemsArray?

How to setup VisibleRange and labelFormat?

  1. In same example. XAxis lable fixed start to 0(does not move to outside of left for each new data)

How to move xAxis label right to left when new data generated?

Thanks for you kindness.

0 votes
10k views

Hi,

I set up my xAxis (DateAxis) with a minimalZoomConstrain = DateInterval.fromMinutes(3.0). And here is my PinchZoomModifier:

val pinchZoomModifier = PinchZoomModifier().apply {
        direction = Direction2D.XDirection
        receiveHandledEvents = true
    }

The chart works great and restricts the zoom to three minutes, but I get this error to the console whenever I zoom in to reach the minimalZoomConstrain:

E/Axis: VisibleRange was restored to its last valid value. The range class com.scichart.data.model.DateRange (Min = Tue Jan 09 01:52:40 GMT+01:00 2020, Max = Tue Jan 09 01:55:40 GMT+01:00 2020) either is not valid or it doesn't satisfy MinimalZoomConstrain or MaximumZoomConstrain. To provide fallback value please override AxisCore#coerceVisibleRange(IRange) method

How can I get rid of this error? Is there a way to tell the PinchZoomModifier that there is a min limit?

0 votes
13k views

Hello

I have this chart with CategoryXAxis` as X and **NumericAxis as Y. I update its IohlcDataseries with new prices for creating a live chart. I also added a HorizontalLineAnnotation on Y-Axis to point to the current price. The problem is when chart auto-scales on Y-axis it only tries to cover price data and not the Line annotation, and its label is half visible.

0 votes
5k views

Hi,
=>Scenario
i am using one LineSeries, two ScatterSeries and one ErrorBarsSeries in my Graph.

=> ISSUE
I want to disable whole Rollover Modifier or labels of Rollover Modifier for only ErrorBarsSeries , How can I do that?

  • Atiq Tahir asked 4 years ago
  • last active 4 years ago
0 votes
0 answers
13k views

I am creating a chart to represent certain vitals. The code is almost identical to the Vitals Monitoring Demo application, the difference being
I added some Line and text annotations. I am appending points to the data series every 100ms. I have verified that the anomalous behavior is not caused due to wrong data being provided,
leading me to believe it must be a bug within SciChart. I have attached screenshots of this anomalous behavior. Any help would be greatly appreciated. Thank you.

Edit: This happens randomly, ie it performs normally without glitches on application startup but misbehaves after left running for a while.
I also observed that when I call .clear() on the XyDataSeries objects, the graph returns to normalcy, but only until FIFO_CAPACITY is reached. It then goes back to wreaking havoc.
I have added sample data (data.txt) to the question for reference, and screenshots of Expected behavior and the abnormal behavior in question.

Gif of the problem is here: https://imgur.com/7SO4DFb

Code used for setting up the chart:

     `SciChartBuilder sciChartBuilder;
     static ISciChartSurface chart;
     public final static XyDataSeries<Double, Double> pressureDataSeries = newDataSeries(FIFO_CAPACITY);
     public final static XyDataSeries<Double, Double> pressureSweepDataSeries = newDataSeries(FIFO_CAPACITY);
     public final static XyDataSeries<Double, Double> flowDataSeries = newDataSeries(FIFO_CAPACITY);
     public final static XyDataSeries<Double, Double> flowSweepDataSeries = newDataSeries(FIFO_CAPACITY);
     public final static XyDataSeries<Double, Double> volumeDataSeries = newDataSeries(FIFO_CAPACITY);
     public final static XyDataSeries<Double, Double> volumeSweepDataSeries = newDataSeries(FIFO_CAPACITY);
     public final static XyDataSeries<Double, Double> lastPressureSweepDataSeries = newDataSeries(1);
     public final static XyDataSeries<Double, Double> lastFlowDataSeries = newDataSeries(1);
     public final static XyDataSeries<Double, Double> lastVolumeDataSeries = newDataSeries(1);
     private static XyDataSeries<Double, Double> newDataSeries(int fifoCapacity) {
    final XyDataSeries<Double, Double> ds = new XyDataSeries<>(Double.class, Double.class);
    ds.setFifoCapacity(fifoCapacity);
    return ds;
}
 private void setUpChart() {                          // Called from onCreate()
    try {
        SciChartSurface.setRuntimeLicenseKey("");
    } catch (Exception e) {
        e.printStackTrace();
    }
    final String pressureId = "pressureId";
    final String flowId = "flowId";
    final String volumeId = "volumeId";
    SciChartBuilder.init(this);
    sciChartBuilder = SciChartBuilder.instance();
    chart = new SciChartSurface(this);
    LinearLayout chartLayout = findViewById(R.id.charts);
    chartLayout.addView((View) chart, 0);
    final NumericAxis xAxis = sciChartBuilder.newNumericAxis()
            .withVisibleRange(0, 10)
            .withAutoRangeMode(AutoRange.Never)
            .withAxisBandsFill(5)
            .withDrawMajorBands(true)
            .withAxisId("XAxis")
            .build();

    DoubleValues pressureRange = new DoubleValues(); pressureRange.add(-10); pressureRange.add(65);
    DoubleValues flowRange = new DoubleValues(); flowRange.add(-150); flowRange.add(+250);
    DoubleValues volumeRange = new DoubleValues(); volumeRange.add(-500); volumeRange.add(1000);

    final NumericAxis yAxisPressure = generateYAxis(pressureId, getMinMaxRange(pressureRange));
    final NumericAxis yAxisFlow = generateYAxis(flowId, getMinMaxRange(flowRange));
    final NumericAxis yAxisVolume = generateYAxis(volumeId, getMinMaxRange(volumeRange));

    UpdateSuspender.using(chart, new Runnable() {
        @Override
        public void run() {
            Collections.addAll(chart.getAnnotations(),
                    sciChartBuilder.newTextAnnotation()
                            .withXAxisId("XAxis")
                            .withYAxisId(pressureId)
                            .withY1(0d)
                            .withFontStyle(18, ColorUtil.White)
                            .withText(" Pressure (cm H2O)")
                            .build(),
                    generateBaseLines(pressureId),
                    sciChartBuilder.newTextAnnotation()
                            .withXAxisId("XAxis")
                            .withYAxisId(flowId)
                            .withY1(0d)
                            .withFontStyle(18, ColorUtil.White)
                            .withText(" Flow (lpm)")
                            .build(),
                    generateBaseLines(flowId),
                    sciChartBuilder.newTextAnnotation()
                            .withXAxisId("XAxis")
                            .withYAxisId(volumeId)
                            .withY1(0d)
                            .withFontStyle(18, ColorUtil.White)
                            .withText(" Volume (ml)")
                            .build(),
                    generateBaseLines(volumeId)
            );
            Collections.addAll(chart.getXAxes(), xAxis);
            Collections.addAll(chart.getYAxes(), yAxisPressure, yAxisFlow, yAxisVolume);
            Collections.addAll(chart.getRenderableSeries(),
                    MainActivity.this.generateLineSeries(pressureId, pressureDataSeries, sciChartBuilder.newPen().withColor(Color.parseColor("#00ff00")).withThickness(1.5f).build()),
                    MainActivity.this.generateLineSeries(pressureId, pressureSweepDataSeries, sciChartBuilder.newPen().withColor(Color.parseColor("#00ff00")).withThickness(1.5f).build()),
                    MainActivity.this.generateScatterForLastAppendedPoint(pressureId, lastPressureSweepDataSeries),

                    MainActivity.this.generateLineSeries(flowId, flowDataSeries, sciChartBuilder.newPen().withColor(Color.parseColor("#ff6600")).withThickness(1.5f).build()),
                    MainActivity.this.generateLineSeries(flowId, flowSweepDataSeries, sciChartBuilder.newPen().withColor(Color.parseColor("#ff6600")).withThickness(1.5f).build()),
                    MainActivity.this.generateScatterForLastAppendedPoint(flowId, lastFlowDataSeries),

                    MainActivity.this.generateLineSeries(volumeId, volumeDataSeries, sciChartBuilder.newPen().withColor(Color.parseColor("#FFEA00")).withThickness(1.5f).build()),
                    MainActivity.this.generateLineSeries(volumeId, volumeSweepDataSeries, sciChartBuilder.newPen().withColor(Color.parseColor("#FFEA00")).withThickness(1.5f).build()),
                    MainActivity.this.generateScatterForLastAppendedPoint(volumeId, lastVolumeDataSeries)
            );
            chart.setLayoutManager(new DefaultLayoutManager.Builder().setRightOuterAxesLayoutStrategy(new RightAlignedOuterVerticallyStackedYAxisLayoutStrategy()).build());
        }
    });
}

private HorizontalLineAnnotation generateBaseLines(String yAxisId) {
    return sciChartBuilder.newHorizontalLineAnnotation().withStroke(1, ColorUtil.White).withHorizontalGravity(Gravity.FILL_HORIZONTAL).withXAxisId("XAxis").withYAxisId(yAxisId).withY1(0d).build();
}

private NumericAxis generateYAxis(String id, DoubleRange visibleRange) {
    return sciChartBuilder.newNumericAxis().withAxisId(id).withVisibleRange(visibleRange).withAutoRangeMode(AutoRange.Never).withDrawMajorBands(false).withDrawMinorGridLines(true).withDrawMajorGridLines(true).build();
}
private FastLineRenderableSeries generateLineSeries(String yAxisId, IDataSeries ds, PenStyle strokeStyle) {
    FastLineRenderableSeries lineSeries = new FastLineRenderableSeries();
    lineSeries.setDataSeries(ds);
    lineSeries.setPaletteProvider(new DimTracePaletteProvider());
    lineSeries.setStrokeStyle(strokeStyle);
    lineSeries.setXAxisId("XAxis");
    lineSeries.setYAxisId(yAxisId);
    return lineSeries;
}
private IRenderableSeries generateScatterForLastAppendedPoint(String yAxisId, IDataSeries ds) {
    final EllipsePointMarker pm = sciChartBuilder.newPointMarker(new EllipsePointMarker())
            .withSize(4)
            .withFill(ColorUtil.White)
            .withStroke(ColorUtil.White, 1f)
            .build();

    return sciChartBuilder.newScatterSeries()
            .withDataSeries(ds)
            .withYAxisId(yAxisId)
            .withXAxisId("XAxis")
            .withPointMarker(pm)
            .build();
}

private static DoubleRange getMinMaxRange(DoubleValues values) {
    final DoubleRange range = new DoubleRange();
    SciListUtil.instance().minMax(values.getItemsArray(), 0, values.size(), range);
    range.growBy(0.1, 0.1);
    return range;
}

   // Appending to data series with:
    UpdateSuspender.using(MainActivity.chart, new Runnable() {
        @Override
        public void run() {
            MainActivity.pressureDataSeries.append(x, ppA);
            MainActivity.pressureSweepDataSeries.append(x, ppB);

            MainActivity.flowDataSeries.append(x, vFlowA);
            MainActivity.flowSweepDataSeries.append(x, vFlowB);

            MainActivity.volumeDataSeries.append(x, vtfA);
            MainActivity.volumeSweepDataSeries.append(x, vtfB);

            MainActivity.lastPressureSweepDataSeries.append(x, pp);
            MainActivity.lastFlowDataSeries.append(x, vFlow);
            MainActivity.lastVolumeDataSeries.append(x, vtf);
        }
    });

`

0 votes
3k views

Hello Everybody,

I have to continue a Xamarin.Forms application that mainly target android devices. The developer before me wrote everything in shared code and the question is:

Is it possible the use SciChart Xamarin chart in shared code in xaml or I have to code it in Xamarin.Android project?

I am new to Xamarin and just learning the things.
Thanks for the answers and any advice.

Bests,
Roland

0 votes
6k views

I am using RenderSurfaceGL in my chart but I am not able to use Transparency.
What should I do to do this?

0 votes
13k views

Hi,

I have multiple custom chart modifiers (PinchZoom, Rollover, SeriesSelection and ZoomPan) and I was wondering if there is a set order in which they handle the touch event or is it random? If there is a set order then can I change this order?

For example now it seems like the rollover modifier handles the touch event before the seriesSelection modifier. This is a bit problematic since the rollover has sourceMode = SourceMode.SelectedSeries and since the touch event goes first to the rollover it updates its position –> then the new series is selected –> but rollover position does not update since it has already handled the touch event.

0 votes
7k views

Hello,

I have two questions about how to get axes or annotations by ID.

First, I trying to update the VisibleRange for X axis in the internalUpdate function in the UniformHeatmapSeriesTooltip. When I use getAxisById, my ECG data series is gone from the chart. But it works if I use getDefault() instead (axis Id not defined). So I kind of confused.

private class CustomHeatmapTooltip extends UniformHeatmapSeriesTooltip {

        public CustomHeatmapTooltip(Context context, UniformHeatmapSeriesInfo heatmapInfo) {
            super(context, heatmapInfo);
        }
        @Override
        protected void internalUpdate(UniformHeatmapSeriesInfo heatmapInfo) {
            ecgSurface.getXAxes().getAxisById("ecgx").setVisibleRange(new DateRange(startDate, stopDate));
        }
}

Second, I have one vertical line annotation and multiple text annotations. Every time I render the heatmap, I want to remove the text annotations and add some new text annotations as needed, without touching the vertical line annotation. Is there a way to only remove the text annotations?

Thanks a lot.

  • Gang Xu asked 4 years ago
  • last active 4 years ago
0 votes
7k views

Hi,

I tried to implement a colormap view next to the heatmap chart. But couldn’t figure out how to set it up. It seems like it won’t work this way.

SciChartHeatmapColourMap colorMapView = new SciChartHeatmapColourMap(this);
colorMapView.findViewById(R.id.colorMapView);

I don’t know how Bindview works in the example code. Could you tell me how to link SciChartHeatmapColourMap to the view in layout xml?

Thanks.

  • Gang Xu asked 4 years ago
  • last active 4 years ago
0 votes
5k views

Hi,

I’d like to set line chart’s date xAxis ticks to be exactly one day apart in a way that where the label is shown, the time would be exactly 24:00.
I know I can set the minorDelta() and majorDelta(), but what value should I provide them? The minor tick when I zoom in should be 2 minutes and the major tick should be 24 hours.

0 votes
4k views

Hi,

I tried to initialize heatmap chart with NaN to make it transparent, but it doesn’t work that way. The color was blue, which is zero in the colormap. Is there a way to make it not showing any color?

Thanks,

public void initECMSciChart() {
    // initialize chart with NaN
    for (int i = 0; i < MATRIX_COLUMNS; i++) {
        for (int j = 0; j < MATRIX_ROWS; j++) {
            heatmap2DMatrix[i][j] = 0;
            heatmapDataSeries.updateZAt(i, j, Double.NaN);
        }
    }
    heatmapDataSeries.setStartX(0d);
    heatmapSurface.zoomExtentsX();
}
  • Gang Xu asked 4 years ago
  • last active 4 years ago
0 votes
4k views

Hi,

I’m wondering is there a way to temporarily disable zoompan modifier while I re-rendering the chart. My re-rendering on the heatmap might take a second, I hope the interaction can be disabled during that process.
Thanks.

  • Gang Xu asked 4 years ago
  • last active 4 years ago
0 votes
13k views

Hi
I have a ECG chart with a certain capacity.
I want to apply the fading animation to the part of the chart that is being cleared.

0 votes
14k views

Hi
I have a line chart that has already been drawn and synced with a sound.
when we play sound, chart begin to scroll horizontally.
but problem is lagging when scrolling chart.
Is there a way to fix this problem?

private Runnable mRunnable = new Runnable() {
    @Override
    public void run() {
        forceRunInPauseMode = false;

        getActivity().runOnUiThread(() -> {
            currentTime = (int) exoPlayer.getCurrentPosition();
            binding.tvCurrentDuration.setText(MiliToTimeConverter.milliToTime(currentTime));
        });

        int currentRange = currentTime * 2;


        if (!isDraw) {
            DoubleValues xValues = new DoubleValues(Arrays.copyOfRange(xDoubleArray, 0, xDoubleArray.length - 1));
            DoubleValues yValues = new DoubleValues(Arrays.copyOfRange(yDoubleArray, 0, yDoubleArray.length - 1));
            DoubleSeries doubleSeries = new DoubleSeries(xValues, yValues);
            lineData.append(doubleSeries.getxValues(), doubleSeries.getyValues());
            isDraw = true;
        }
        xVisibleRange.setMinMax(currentRange - visibleInterval / 2, currentRange + visibleInterval / 2);
    }
};

private void updateChart() {
    schedule = scheduledExecutorService.scheduleWithFixedDelay(() -> {
        if (!isPlaying && !forceRunInPauseMode)
            return;
        UpdateSuspender.using(binding.sciChart, mRunnable);
    }, 0, TIME_INTERVAL, TimeUnit.MILLISECONDS);
}


private void pause() {
    exoPlayer.setPlayWhenReady(false);
    binding.ivPlay.setImageResource(R.drawable.ic_play);
    if (schedule != null)
        schedule.cancel(false);
}

private void initSciChart() {

    isChartConfigured = true;
    SciChartBuilder.init(getContext());
    binding.sciChart.setBackgroundColor(getResources().getColor(R.color.colorTransparent));

    // Obtain the SciChartBuilder instance
    SciChartBuilder mSciChartBuilder = SciChartBuilder.instance();

    //set border style
    binding.sciChart.setRenderableSeriesAreaBorderStyle(null);

    xVisibleRange = new DoubleRange();

    // Create a numeric X axis
    final IAxis xAxis = mSciChartBuilder.newNumericAxis()
            .withVisibleRange(xVisibleRange)
            .withGrowBy(new DoubleRange(0.25d * visibleInterval / totalDuration, 0.25d * visibleInterval / totalDuration))
            .withAutoRangeMode(AutoRange.Never)
            .build();

    final IAxis yAxis = mSciChartBuilder.newNumericAxis()
            .withVisibleRange(-1d, 1d)
            .withAutoRangeMode(AutoRange.Never)
            .build();

    xAxis.setVisibleRangeChangeListener((iAxisCore, oldRange, newRange, isAnimating) -> {
        if (!isPlaying) {
            double c = ((newRange.getMinAsDouble() + newRange.getMaxAsDouble()) / 4);
            getActivity().runOnUiThread(() -> binding.tvCurrentDuration.setText(MiliToTimeConverter.milliToTime((long) c)));
        }
    });


    xAxis.setDrawMajorGridLines(false);
    xAxis.setDrawMinorGridLines(false);
    xAxis.setDrawMajorBands(false);
    xAxis.setDrawMajorTicks(true);
    xAxis.setDrawMinorTicks(true);
    xAxis.setTickProvider(new CustomTickProvider());
    xAxis.setMaxAutoTicks(MAX_AUTO_TICKS);
    xAxis.setMinorsPerMajor(MINOR_PER_MAJOR);
    xAxis.setVisibility(View.GONE);


    yAxis.setDrawMajorGridLines(false);
    yAxis.setDrawMinorGridLines(false);
    yAxis.setDrawMajorBands(false);
    yAxis.setDrawMajorTicks(false);
    yAxis.setDrawMinorTicks(false);
    yAxis.setTickProvider(new CustomTickProvider());
    yAxis.setMaxAutoTicks(MAX_AUTO_TICKS);
    yAxis.setMinorsPerMajor(MINOR_PER_MAJOR);
    yAxis.setVisibility(View.GONE);


    VerticalLineAnnotation verticalLine = mSciChartBuilder.newVerticalLineAnnotation()
            .withX1(0.5)   // black
            .withStroke(new SolidPenStyle(ColorUtil.argb(250, 120, 126, 136), true, 1f, null))
            .withCoordinateMode(AnnotationCoordinateMode.RelativeX)
            .build();

    ModifierGroup chartModifiers = mSciChartBuilder.newModifierGroup()
            .withModifier(new GestureModifierBase() {
                @Override
                public void detach() {
                    super.detach();
                }

                @Override
                public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
                    return false;
                }

                @Override
                public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
                    // Scroll X
                    xAxis.scroll((-distanceX/2), ClipMode.ClipAtExtents);

                    return true;
                }
            })
            .build();

    lineData = mSciChartBuilder.newXyDataSeries(Double.class, Double.class).build();
    XyDataSeries staticData = mSciChartBuilder.newXyDataSeries(Double.class, Double.class).build();

    final FastLineRenderableSeries lineSeries = mSciChartBuilder.newLineSeries()
            .withDataSeries(lineData)
            //.withPointMarker(mSciChartBuilder.newPointMarker(new EllipsePointMarker()).withSize(7, 7).withStroke(0xFF006400, 1).withFill(0xFFFFFFFF).build())
            .withPaletteProvider(new XYCustomPaletteProvider(ColorUtil.argb(255, 50, 153, 0))) // green
            .withStrokeStyle(ColorUtil.argb(250, 120, 126, 136), 1f, true) // black
            .build();

    final IRenderableSeries staticLineSeries = mSciChartBuilder.newLineSeries()
            .withDataSeries(staticData)
            .withPaletteProvider(new XYCustomPaletteProvider(ColorUtil.argb(255, 50, 153, 0))) // green
            .withStrokeStyle(ColorUtil.argb(250, 120, 126, 136), 1f, true) // black
            .build();

    DoubleValues xValues = new DoubleValues(Arrays.copyOfRange(xDoubleArray, 0, totalRange));
    DoubleValues yValues = new DoubleValues(Arrays.copyOfRange(yDoubleArray, 0, totalRange));
    DoubleSeries doubleSeries = new DoubleSeries(xValues, yValues);

    binding.sciChart.getRenderableSeries().add(lineSeries);
    binding.sciChart.getRenderableSeries().add(staticLineSeries);

    binding.sciChart.setRenderSurface(new RenderSurface(getContext()));

    Collections.addAll(binding.sciChart.getYAxes(), yAxis);
    Collections.addAll(binding.sciChart.getXAxes(), xAxis);
    Collections.addAll(binding.sciChart.getChartModifiers(), chartModifiers);
    Collections.addAll(binding.sciChart.getAnnotations(), verticalLine);

    staticData.append(doubleSeries.getxValues(), doubleSeries.getyValues());
    lineData.setAcceptsUnsortedData(true);

    begin();
}
Showing 151 - 200 of 537 results