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

<!–

Welcome to the SciChart Android Charts Community Forums!

Please see our Question asking guidelines before posting. You can also find our Android Charts Documentation in the SciChart Android SDK Zip.
  – Thanks & regards, SciChart Team

–>

Welcome to the SciChart Community Forums!

Please note, for the month of May we are trialling a switch to Stackoverflow.com for ad-hoc support of our chart controls. Please create an account and ask questions with the Tag=SciChart on Stackoverflow.

We welcome your feedback on this move as well, contact us to voice your opinion!

0 votes
122 views

our app is about Futures. we will buy license for IOS and Android.

we found some question.

so we need show very small values, like Euro exchange’s values will be from 1.1981 to 1.2008.
its Tick Size is 0.0001 .

but we use LogarithmicNumericAxis with OhlcDataSeries<Date, Double> , surface still linear scale.

other question.
how to custom LogarithmicNumericAxis’s “TextFormatting” like “$0.0000”

  • Rey Liang asked 3 weeks ago
  • last active 3 weeks ago
0 votes
102 views

In Xamarin.IOS when you set the legend to Horizontal and Top it will create a legend at the top then allow you to scroll horizontally to see all your LineSeries. In Xamarin.Android when you have more Series than can originally fit on the screen, the legend malfunctions and takes up the entire screen. Picture will be attached.

0 votes
0 answers
89 views

When i go to zoom on my YAxis while a YAxis VisibleRangeLimit is baing set, the zoom does not work correctly. Once the zooming is finished it will reset back to the range limit. If i remove the range limit, the zooming then works as expected.

0 votes
134 views

Hi,

I’m working on the iOS and android version. I’m trying to implemented an animated visible range change on Y axis when zooming/panning X axis.

On iOS, I just have to do:
yAxis.autoRange = .always
yAxis.animateVisibleRangeChanges = true
yAxis.animatedChangeDuration = 0.5

But I can’t find a way to do that on Android, is it hidden somewhere else?

Kind Regards,
Alexis

0 votes
128 views

When I open activity with chart on real devices chart area for a moment has black color and theh succesfuly displayed chart data.
On emulators I do not see thes behavior.
How can I fix black screen?

0 votes
114 views

Hi,
I want to implement a chart that represent currency changed rate, so that the chart will show a rise with a green point and a fall with a red point.

in the image I’ve uploaded I’ve used Custom PaletteProvider to manipulate the colors accordingly.

what I want to implement is instead of coloring the Point (Ellipse) I want to load an Image.
the closest i’ve got is to load a single image to all the points, without theme changing (red or green) accordingly.

I did managed to implement that exact behavior in iOS.

how could I implement a dynamically changing Sprits in a PaletteProvider ?

Thanks in advance…

0 votes
118 views

Can you help me please!
I was searching forum and see all different questions with dfferent ansvers but no one help for me.

I’m using CategoryDateAxis and whant to show to users vertical lines between days, weeks or month
Its depends from timestamp and visible period.
I need to opportunity to provide themself when to display vertical line.

In chart I display CandlestickSeries from stosk market and users whant to know when one day is ended and new day is begin.

How can I do that?

0 votes
120 views

I have CategoryDateAxis and whant to setup range limit from series size – 50 to series size + 10

mBottomAxis.setVisibleRangeLimit(new DoubleRange(series.size() - 50d, series.size() + 10d));
mBottomAxis.setVisibleRangeLimitMode(RangeClipMode.MinMax);

And this code works but not as I expected
When I scrol chalt and hits the range limit scroll is stopped BUT chart is zooming in

How to disable zooming when I hits the limit?

0 votes
101 views

When trying to create a candlestick graph, if I have data with no high low bars with a range of more than 0.00950 then the graph won’t zoom in on initial load. See my code further below. Above 0.00950 and it’s okay. BTW I’ve tried withVisibleRage.

Please help, my trial is going to run out soon. I’m really stuck.

For example:

The following won’t zoom in:

[
    {
        "symbol": "AUDCAD",
        "ctm": "2018-02-10 09:00:00",
        "high": 0.98000,
        "low": 0.97100,
        "open": 0.97900,
        "close": 0.97800,
        "volume": 1238
    } ]

The following does zoom in:

[
    {
        "symbol": "AUDCAD",
        "ctm": "2018-02-10 09:00:00",
        "high": 0.98000,
        "low": 0.97000,
        "open": 0.97900,
        "close": 0.97800,
        "volume": 1238
    }
]

Here’s a screenshots:

enter image description here enter image description here

Here’s the code which produces the charts:

final CategoryDateAxis xAxis = sciChartBuilder.newCategoryDateAxis()
        .withVisibility(isMainPane ? View.VISIBLE : View.GONE)
        .withAutoTicks(true)
        .withGrowBy(new DoubleRange(0d, 0.1d))
        .build();

final NumericAxis yAxis = sciChartBuilder
        .newNumericAxis()
        .withAxisId(PRICES)
        .withAutoRangeMode(AutoRange.Always)
        .withDrawMinorGridLines(true)
        .withDrawMajorGridLines(true)
        .withMinorsPerMajor(10)
        .withMaxAutoTicks(20)
        .withGrowBy(new DoubleRange(0d, 0.1d))
        .build();

surface.getXAxes().add(xAxis);
surface.getYAxes().add(yAxis);

surface.getRenderableSeries().addAll(model.renderableSeries);
0 votes
124 views

How can I append a float array to an XYDataSeries?

I’m developing an app with scichart. I receive buffers of 20 floats in a float[] type. How can I append this buffer to an XYDataSeries? The chart is updated in real time each time one Buffer is received with FIFO capacity.

What I need is something similar to:

void updateChart(final float[] a, final float[] b) {
    UpdateSuspender.using(surface, new Runnable() {
            @Override
            public void run() {
                // Append the new data received
                lineData.append(a,b);
                // Zoom series to fit the viewport to the x variable
                surface.zoomExtentsX();
            }
        });
}

Is this possible?
Thank you in advance

0 votes
139 views

I have an error after update Android Stutio to version 3.1
But project is steel builds and run successfully

0 votes
128 views

Hi

Please can you give me a guide as to how to pull out the Android EEG channel example into a standalone project so that I can use it and build on it.

I have tried but I am getting errors.

Thanks

  • BuchananA5 asked 2 months ago
  • last active 1 month ago
0 votes
241 views

Hi everyone!

Tell me please why this is happening (in logcat) This is the message I always get the first call or load the markup with scichart

03-30 14:20:46.406 3564-3564/com.gtmobile D/WellDetailChartFragment: BEFORE INFLATE…
03-30 14:20:46.457 3564-3564/com.gtmobile E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
03-30 14:20:46.471 3564-3564/com.gtmobile D/WellDetailChartFragment: AFTER INFLATE…

Сan anyone give me an example of markup for <android.support.design.widget.CoordinatorLayout>
what should I use there is a container to display the scichart?

Have tried containers for Fragment with scichart :

in the first case gives an error (Perhaps this is not acceptable, because the container has a scroll)

<android.support.v4.widget.NestedScrollView
    android:id="@+id/well_detail_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

in the second case is not displayed, ie just empty.

<FrameLayout
    android:id="@+id/well_detail_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

I need to work in the wide screen mode (tablet) has several elements on the screen.

In simple activity (as in your examples) everything works perfectly.

On my test device Android 7.0

Android Studio 3.1
Gradle(app)
minSdkVersion 19
targetSdkVersion 26
I am using trial version scichart which will end in a few days 🙁

Thanks in advance for any information.

0 votes
138 views

Hi all,

I’m developing an app which receives and displays 100’s of samples per second similar to what you would see with the FIFO tutorial. Instead of the sample number, 1000, 1001, etc., I’d like to show seconds so far instead of the sample number.

For example, at sample 1000 display 10, from 1001 to 1099 display nothing, at 1100 display 11, etc. Something simple like sampleNum/100. Can you give me a hint where to start looking to change the behavior of the (major?) tick markings? Do I do something with the NumericAxis class?

Thank you for pointers.

Ed

0 votes
174 views

Hello,
in SciChart Android the vertically-oriented axis title is displayed like this:
a1

I’d like to rotate the title -180 degrees, so that it looks like that (that is the default behaviour in SciChart iOS):
a2
Is there a way to achieve that?

  • Anna Lazar asked 2 months ago
  • last active 2 months ago
0 votes
150 views

I have a candlestick chart to display an Ohlc data. (Kotlin, Android)

        val candlestickXAxist = sciChartBuilder
            .newCategoryDateAxis()
            .withVisibleRange(range)
            .withAutoTicks(true)
            .build()

        val candlestickYAxist = sciChartBuilder
            .newNumericAxis()
            .build()

        val fastCandlestickRenderableSeries = sciChartBuilder.newCandlestickSeries()
            .withStrokeUp(upColor)
            .withFillUpColor(upColor)
            .withStrokeDown(downColor)
            .withFillDownColor(downColor)
            .withDataSeries(ohlcDataSeries)
            .build()

        UpdateSuspender.using(priceChart) {
            Collections.addAll(priceChart.xAxes, candlestickXAxist)
            Collections.addAll(priceChart.yAxes, candlestickYAxist)
            Collections.addAll(priceChart.annotations, this.currentAnnotation)
            Collections.addAll(priceChart.renderableSeries, this.fastCandlestickRenderableSeries)
            Collections.addAll(priceChart.chartModifiers, sciChartBuilder.newModifierGroupWithDefaultModifiers().build())
        }

In some cases, I need the chart displays the data in a specific date (X value) instead of user should move/pan the chart.

I have tried this

UpdateSuspender.using(priceChart){
                val lastData = priceSeries.last()
                val lastTime = lastData.timePeriodStart.time
                val oneHourAgo = lastTime - 1000*60*60

                Log.i("CHAR_DEMO", "Display time from ${Date(oneHourAgo)} to ${Date(lastTime)}")

                candlestickXAxist.visibleRange = DoubleRange(lastTime.toDouble(), oneHourAgo.toDouble())
                candlestickXAxist.invalidateElement()
            }

But it didn’t work.

And notice that, I’m not sure why the chart xAxis is CategoryDateAxis but the visibleRange is IRange instead of DateRange.

enter image description here

Can someone help me?

Thank you.

  • Vo Hoa asked 2 months ago
  • last active 2 months ago
0 votes
145 views

Hello,

I have added a HorizontalLineAnnotation successfully on my android app.

However, when data changes, I want to update the position (and the label) of it but I don’t see any method of class HorizontalLineAnnotation to do it.

enter image description here

Can someone help me?

Thank you

  • Vo Hoa asked 2 months ago
  • last active 2 months ago
0 votes
150 views

hello, I am Japanese

I am sorry that I am not good at English.

I would like to draw a basic real-time chart

Get numbers from arduino
/arduino/analog/0

I’d like to use HttpURLConnection and get numbers as short as possible

There was something I wanted in the sample. I want to rewrite this and use it

AnimatingLineChart

I do not know where to rewrite
I am satisfied if it can be displayed with 1 line chart

I want a format that can be built

Thank you

0 votes
153 views

I have this strict mode configuration:

StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
            .detectDiskReads()
            .detectDiskWrites()
            .detectNetwork()
            .penaltyLog()
            .build());

StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
            .detectLeakedSqlLiteObjects()
            .detectLeakedClosableObjects()
            .penaltyLog()
            .penaltyDeath()
            .build());

I have an error when I rotate screen:

 03-15 09:40:24.215 29914-29923 E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
   java.lang.Throwable: Explicit termination method 'release' not called
       at dalvik.system.CloseGuard.open(CloseGuard.java:223)
       at android.view.Surface.setNativeObjectLocked(Surface.java:554)
       at android.view.Surface.<init>(Surface.java:187)
       at com.scichart.drawing.opengl.ac.<init>(SourceFile:69)
       at com.scichart.drawing.opengl.n.createCanvasTexture(SourceFile:140)
       at com.scichart.charting.visuals.axes.AxisTickLabelsRendererComponent.onDraw(SourceFile:120)
       at com.scichart.charting.visuals.axes.AxisTickLabelsRendererComponent$HorizontalAxisTickLabelsRendererComponent.onDraw(SourceFile:278)
       at com.scichart.charting.visuals.axes.f.onDraw(SourceFile:182)
       at com.scichart.charting.visuals.axes.AxisBase.onDraw(SourceFile:866)
       at com.scichart.charting.visuals.rendering.RenderSurfaceRenderer.a(SourceFile:491)
       at com.scichart.charting.visuals.rendering.RenderSurfaceRenderer.g(SourceFile:485)
       at com.scichart.charting.visuals.rendering.RenderSurfaceRenderer.a(SourceFile:359)
       at com.scichart.charting.visuals.rendering.RenderSurfaceRenderer.a(SourceFile:134)
       at com.scichart.charting.visuals.rendering.RenderSurfaceRenderer.onDraw(SourceFile:123)
       at com.scichart.drawing.opengl.RenderSurfaceGL$a.onDraw(SourceFile:228)
       at com.scichart.drawing.opengl.MyGLRenderer.b(SourceFile:299)
       at com.scichart.drawing.opengl.MyGLRenderer.onDrawFrame(SourceFile:283)
       at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1571)
       at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)
0 votes
164 views

In the picture below you can see that upday bar can be:
1. open in the left
2. close in the right
3. close is greater then open
enter image description here

As you can see in the screenshot I have different behavior

0 votes
239 views

Now I using white collor for backgrounds:

 <!-- Background defaults -->
<item name="sciChartBackground">@color/white</item>
<item name="legendBackground">@color/white</item>
<item name="axisTooltipBackground">@color/white</item>

But I whant to display text view uhder chart
When I set backgrounds as transparent I see black lines

And questions is:
1. how can I setup chart to display text under chart component
2. where I can read/see information about styles and for which each parameter is needed.

On first screenshot its what I needed
On second one what I have

0 votes
195 views

Hello everyone,

I am the beginner of SciChart, now I able to create a candlestick chart with a HorizontalLineAnnotation but it doesn’t display well.

I have checked-out this tutorial

https://www.scichart.com/documentation/v5.x/webframe.html#The%20HorizontalLineAnnotation%20Type.html

I tried to convert the C# code and XML document to Kotlin but it seems there are no class AnnotationLabel found from the library.

Bellow is my screenshot

enter image description here

You can see the issue is the HorizontalLineAnnotation doesn’t contain the label (with value). What I need is it should have a label as bellow

enter image description here

Bellow is my implementation (in Kotlin)

val xAxis = sciChartBuilder.newCategoryDateAxis().build()
    val yAxis = sciChartBuilder
            .newNumericAxis()
            .build()
val currentAnnotation = sciChartBuilder
            .newHorizontalLineAnnotation()
            .withBackgroundColor(0xFFFCB51E.toInt())
            .withYValue(currentValue).build()

val rSeries = sciChartBuilder.newCandlestickSeries()
            .withStrokeUp(upColor)
            .withFillUpColor(upColor)
            .withStrokeDown(downColor)
            .withFillDownColor(downColor)
            .withDataSeries(dataSeries)
            .build()

    UpdateSuspender.using(surface) {
        Collections.addAll(surface.xAxes, xAxis)
        Collections.addAll(surface.yAxes, yAxis)
        Collections.addAll(surface.annotations, currentAnnotation)
        Collections.addAll(surface.renderableSeries, rSeries)
        Collections.addAll(surface.chartModifiers, sciChartBuilder.newModifierGroupWithDefaultModifiers().build())
    }

Can someone please help me on this?

  • Vo Hoa asked 3 months ago
  • last active 3 months ago
0 votes
188 views

Hi,

I’m trying to wrap the Scichart surface in XF. I’ve used native views as recommended in documentation and there is no problem when the SciChartSurface is the only element in a ContentPage, but when the surface is placed inside a layout or merged with any other element, then is not rendering.

Do you know why is this happening and how can I merge XF controls and SciChartSurface(s) in a ContentPage or any Layout?

1: This is rendering without problem

    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:SciChartForms"
             xmlns:localAndroid="clr-namespace:SciChartForms.Droid"
             x:Class="SciChartForms.MainPage">
    <localAndroid:Stripchart />
</ContentPage>

2: This is not rendering:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:SciChartForms"
             xmlns:localAndroid="clr-namespace:SciChartForms.Droid"
             x:Class="SciChartForms.MainPage">
    <StackLayout Margin="20">
        <Button Text="adafsd"/>
        <localAndroid:Stripchart/>
    </StackLayout>
</ContentPage>

Thanks in advance!

PS: I’ve also tried with custom renderer obtaining the same result.

  • S C asked 3 months ago
  • last active 3 months ago
0 votes
159 views

I see MountainSeries has property “IsDigitalLine”
But how can I configure MountainSeries with rounded corners like in a picture below

0 votes
193 views

Now I using different library for displaing candles.
And have two different styles of candles.
enter image description here

An author of library that I using strongly recomended this one library.
And I try to port my app to SciChart.
How can I change CandlestickSeries to displayed as a Bar Chart

0 votes
223 views

Hi,

I have issue with export SciChart to Bitamp. I have to generate pdf report from data. Report contains two charts.

It is possible to render chart in memory and export to bitmap? I know it is possible in WPF but I couldn’t achive this in Android.

Now my solution is that I render this charts on fragments and wait 1s on each to render and then save chart. But this solution is not good. For slower devices chart is not exported correctly.

For example on one device have strange grid (only exported bitmap, fragment with this chart looks good):

Chart

  • Marcin K asked 3 months ago
  • last active 3 months ago
0 votes
212 views

I have issue with legend on high resolutions screens. Checkboxes and text is very small and hard to read. I couldn’t find any solution to change text size or provide my own template with text size for legend in Android SciChart.

I want to change legend text size depends on screen like it is in Android by declaring size in dimens.xml.

I do that for Axis labels but I don’t know how do the same for text in legend.

Does anyone know how to achieve this?

  • Marcin K asked 3 months ago
  • last active 3 months ago
0 votes
177 views

Hi, I want to make the YAxis show only certain label (max, min, or others) only like the attached image. I want to ask if it is possible to show axis value unevenly. Thanks!

  • may lym asked 4 months ago
  • last active 4 months ago
0 votes
227 views

I am developing android app where i received data from pressure sensor(attached to arduino) and want to show it in scichart heatmap. i created succesfully scichart heatmap with IPaletteProvider. Now i want to update the heatmap with pressure sensor but currently i am unable to update my heatmap. Here is my Whole(PressureActivity code)code.

if (intent.getAction().equals(Constants.DATA)) {
String data = intent.getStringExtra(“DATA”);
if (data.contains(“ccccc”)) {
int index = data.indexOf(‘/’);
int indexx = data.indexOf(‘#’);
String d = data.substring((index + 1), indexx);
DoubleValues doubleValues=new DoubleValues(1);
doubleValues.add(Double.parseDouble(d));
dataSeries.updateZValues(doubleValues);
}
}

The above code is piece of android code where i actually received data from arduino and want to show it in heatmap so i update my dataSeries value. In my case
i use UniformHeatmapDataSeries<Integer, Integer, Double> dataSeries
But it did not work and shows only a rectangal of blue color and not updating with coming data.
Any one have any idea how to fix it.Thanks in advance.

  • mtg khan asked 4 months ago
  • last active 4 months ago
0 votes
243 views

hi, I wanted to display the cursor information (x, y value)on the text annotation like the following. I can only find the example of displaying as tooltip, but is it possible to show with the text annotation? Thank you!

  • may lym asked 4 months ago
  • last active 4 months ago
0 votes
209 views

Sometimes the X axis does not display the coordinOne of the pictures in the appendix is normal and one shows incorrect.ates when the chart is moved.
How to solve?

0 votes
232 views

There’s a build error when implementing IPointMarkerPaletteProvider, IFillPaletteProvider, or IStrokePaletteProvider.

MainActivity_P.java:50: error: isAttached() in MainActivity_P cannot override isAttached() in PaletteProviderBase
    public boolean isAttached ()
                   ^
    overridden method is final



 MainActivity_P.java:58: error: attachTo(IServiceContainer) in MainActivity_P cannot override attachTo(IServiceContainer) in       PaletteProviderBase
    public void attachTo (com.scichart.core.IServiceContainer p0)
                ^
    overridden method is final



MainActivity_P.java:66: error: detach() in MainActivity_P cannot override detach() in PaletteProviderBase
    public void detach ()
                ^
    overridden method is fina

What’s wrong with it? See the attached project to reproduce the issue.

  • rubs00 asked 4 months ago
  • last active 3 months ago
0 votes
242 views

How to achieve per-point shapes? I need to have, say, triangle, ellipse, and square shapes on a single line series. It’s pretty straightforward for iOS by overriding the StyleForPoint() method and providing shapes and colors. However, I had hard times figuring it out for Android (Xamarin). I found how to change colors of markers but not shapes. Could anyone help me with this, please?

  • rubs00 asked 4 months ago
  • last active 4 months ago
0 votes
271 views

Please help me on this, as I want to draw/combine multiple charts on a single surface and I am getting Json values from Api & also attaching the Graph look which I want.

Help me how I can achieve this.

Thanks in advance.

0 votes
271 views

How to limit the multiplier of enlargement and reduction when enlarging and reducing

0 votes
277 views

Hello,
I would like to replace the standard “X” tooltip marker with a custom drawable. This article suggests that it is possible to customize the marker, but I wasn’t able to find any examples how to do it. Could you help me with that?
Regards,
Anna

  • Anna Lazar asked 5 months ago
  • last active 5 months ago
0 votes
268 views

Hi, I am trying to a similar result as provided in the Showcase project (ECG Screen).

However I have been struggling for more than two days with the problem of backline. It draws a line back to start.

Here are some screenshots.

enter image description here

How can I get read of back line.

Thanks

0 votes
272 views

Hi, I want to color the axis label by its value,
eg. value< 0 -> show with red color
value = 0 -> show grey color
value > 0 -> show green color

similar to this question, but in android platform, it seems the LabelProvider has function related to the value(string) formatting only. Is there any ways to styling the label? Thanks!

  • may lym asked 5 months ago
  • last active 5 months ago
0 votes
279 views

Hello,
How would one implement X- or Y-Value animations for a simple line chart?
I don’t need real time value animations like in the demo but I have all the data at once and want to animate the X-values when drawing the chart. In MPAndroidChart this is done with a single line specifying the duration and the interpolator:

mChart.animateY(3000, Easing.EasingOption.EaseOutBack);

So long!

0 votes
248 views

On Xamarin iOS there is a property SciChartSurface.ChartTitle.

Is there an equivalent on Xamarin Android?

0 votes
241 views

I’m pretty sure the modifier ZoomExtents fits the entire graph to the screen. But a lot of my interesting data happens right at the far right edge of my graph. So I want to add a buffer.

I’d like to zoom to XMin – XMax0.05 and XMax +XMax0.05.

I do this when loading my graph, and I’d like the double tap of my graph to also zoom to that range.

Any ideas?

0 votes
220 views

1,Is the grid line too dense, can it be reduced?
2,Can the grid lines marked by red frames be hidden?

0 votes
213 views

I want to monitor the event that the chart stops sliding, what’s the way

0 votes
239 views

When setting yAxis to have auto range enabled or when manually calling chartSurface.zoomExtents() after adding new data to chart, the top point are cropped (not shown in the chart). I have attached an image that shows this phenomenon (note: bottom part of the chart is cropped out of the image).

Below is full code of an Activity that reproduces the problem. I also updated the attached image that shows the result of the following code. As you can see both red points with y value of 1.1f are cropped out of the chart.

class MainActivity : AppCompatActivity()
{
    private val chartBuilder by lazy { SciChartBuilder.instance() }
    private val chartSurface by lazy { createChartSurface() }

    override fun onCreate(savedInstanceState: Bundle?)
    {
        super.onCreate(savedInstanceState)

        SciChartBuilder.init(this)
        setContentView(R.layout.activity_main)

        val background = findViewById<ViewGroup>(R.id.background)
        background.addView(chartSurface)

        addPoints()
    }

    private fun createChartSurface(): SciChartSurface
    {
        val surface = SciChartSurface(this)

        val xAxis = chartBuilder.newNumericAxis()
            .withAxisTitle("X Axis title")
            .withVisibleRange(0.0, 1.0)
            .withAutoRangeMode(AutoRange.Always)
            .build()

        val yAxis = chartBuilder.newNumericAxis()
            .withAxisTitle("Y Axis title")
            .withVisibleRange(0.0, 1.0)
            .withAutoRangeMode(AutoRange.Always)
            .build()

        Collections.addAll(surface.xAxes, xAxis)
        Collections.addAll(surface.yAxes, yAxis)

        surface.renderableSeries.add(createSeries(Color.RED))
        surface.renderableSeries.add(createSeries(Color.BLUE))

        return surface
    }

    private fun createSeries(color: Int): FastLineRenderableSeries
    {
        val lineData = chartBuilder.newXyDataSeries(Long::class.javaObjectType, Float::class.javaObjectType)
            .withSeriesName("series")
            .build()

        return chartBuilder.newLineSeries()
            .withDataSeries(lineData)
            .withIsVisible(true)
            .withStrokeStyle(color, 2f, true)
            .build()
    }

    private fun addPoints()
    {
        val xValues = LongValues(longArrayOf(0, 1, 2, 3, 4, 5))

        @Suppress("UNCHECKED_CAST")
        var lineData = chartSurface.renderableSeries[0].dataSeries as XyDataSeries<Long, Float>
        lineData.append(xValues, FloatValues(floatArrayOf(0.9f, 1f, 1.1f, 0.9f, 1.1f, 1f)))

        @Suppress("UNCHECKED_CAST")
        lineData = chartSurface.renderableSeries[1].dataSeries as XyDataSeries<Long, Float>
        lineData.append(xValues, FloatValues(floatArrayOf(0f, 0f, 0f, 0f, 0f, 0f)))
    }
}
0 votes
406 views

Hello,

I am currently evaluating SciChart Android and have some questions:

1)
I am using fragments and when I load the fragment with the chart or replace the chart with another fragment, the view flashes black for a moment. This effect is considerable noticeable because I am using a white background for the chart.
VIDEO EXAMPLE

2)
My application domain is like kind of a stock chart. The Y-Values are Doubles while the X-Values are timestamps.
There are small gaps in the data so the distance from each point to the next one is not always the same.
The example dataset consists of 152 datapoints, starts at November 18, 17:00 and end at November 25, 16:00 with distances which are either 1 hour or 2 hours apart.
When zooming and dragging the graph, some labels for the date seem to appear and disappear at random which is really distracting.
VIDEO EXAMPLE

3)
When the user keeps zooming in, the labels should get more detailed.
It is kinda pointless when all the labels are showing the same day. How can I set it, that when the first visible point and the last visible point are only 2 days apart, that the format on the label is HH:MM and not the day and month?

Also, how can I set the maximum zoom? I got it working with the CategoryDateAxis but with the DateAxis it is different and I don’t know how to use the visibibleRangeLimit as the documentation for timeseries charts is rather lacking in this regard.

Our company is considering buying the chart for Android & iOS but those first two problems are king of a deal breaker for us.
Thank you.

My simple style code:

    <style name="CustomSciChart" parent="SciChart_BaseStyle">
    <item name="sciChartBackground">@android:color/white</item>
    <item name="majorGridLinesColor">@color/midLightGray</item>
    <item name="minorGridLinesColor">@color/midLightGray</item>

My chart code:

    final SciChartBuilder sciChartBuilder = SciChartBuilder.instance();
    surface.setTheme(R.style.CustomSciChart);
    XyDataSeries<Date, Double> lineData = sciChartBuilder.newXyDataSeries(Date.class, Double.class).build();
    final DateAxis xAxis = sciChartBuilder.newDateAxis()
            .withDrawMinorGridLines(false)
            .withDrawMinorTicks(false)
            .withAutoRangeMode(AutoRange.Once)
            .build();

    final IAxis yAxis = sciChartBuilder.newNumericAxis()
            .withAxisAlignment(AxisAlignment.Left)
            .withDrawMinorGridLines(false)
            .withDrawMinorTicks(false)
            .withGrowBy(0.2d, 0.2d)
            .build();

    final IRenderableSeries lineSeries = sciChartBuilder.newLineSeries()
            .withDataSeries(lineData)
            .withStrokeStyle(ContextCompat.getColor(getActivity(), R.color.colorPrimary), 2f, true)
            .build();


    PinchZoomModifier pinchZoomModifier = new PinchZoomModifier();
    pinchZoomModifier.setScaleFactor(1.5f);
    pinchZoomModifier.setDirection(Direction2D.XDirection);
    surface.getChartModifiers().add(pinchZoomModifier);

    ZoomPanModifier zoomPanModifier = new ZoomPanModifier();
    zoomPanModifier.setClipModeX(ClipMode.ClipAtExtents);
    zoomPanModifier.setDirection(Direction2D.XDirection);
    zoomPanModifier.setZoomExtentsY(false);
    surface.getChartModifiers().add(zoomPanModifier);


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

Fragment replacement:

         FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.content, fragment, tag);
        fragmentTransaction.commit();
0 votes
478 views

I am trying to use SciChart library for my project and find out whether it satisfy all requirements.

I am currently trying to display the ECG signal. Therefore the data is coming in realtime.

I have the following configuration

 final NumericAxis xAxis = mSciChartBuilder
                .newNumericAxis()
                .withAxisTitle("Time (seconds)")
                .withDrawLabels(false)
                .withDrawMajorTicks(false)
                .withDrawMinorTicks(false)
                .withDrawMajorBands(false)
                .withDrawMajorGridLines(false)
                .withDrawMinorGridLines(false)
               // .withVisibleRange(0, 2040)
                .withAutoRangeMode(AutoRange.Always)
                //.withAutoRangeMode(AutoRange.Never)
                .build();
        final NumericAxis yAxis = mSciChartBuilder
                .newNumericAxis()
                .withAxisTitle("Voltage (mV)")
                //    .withGrowBy(0.1d, 0.1d)
                .withDrawLabels(false)
                .withDrawMajorTicks(false)
                .withDrawMinorTicks(false)
                .withDrawMajorBands(false)
                .withDrawMajorGridLines(false)
                .withDrawMinorGridLines(false)
                .withVisibleRange(Short.MIN_VALUE, Short.MAX_VALUE)
                .build();

It works but the X axis a little bit scaled/compress.

Here is the result

enter image description here

I need to make it a bit wider.

How can I do this ?

I have tried to set range manually like that

.withVisibleRange(0, 2040)

However in this case it doesn’t show anything.

I would be grateful for any help.

UPDATE

https://drive.google.com/file/d/17p1E-Z_YxiVh_JtwEvlM1PaTVyJ7eyz7/view

0 votes
299 views

I am using StackedColumnRenderableSeries and I have a problem when a data is displayed as it shows the incomplete graph as the second attached image.
Thank you

var xAxis = new DateAxis(this)
{
GrowBy = new DoubleRange(0.1, 0.1),
AxisTitle = “”,
AutoRange = AutoRange.Always,
TextFormatting = “MMM yyyy”,
DrawMajorGridLines = false,
DrawMinorGridLines = false,
AxisBandsStyle = new SolidBrushStyle(0xfff9f9f9),
};

0 votes
256 views

I use the surface.exportToBitmap () to get the picture, but the AxisMarker doesn’t match the actual display, and there’s no sharp arrow. How to solve?

0 votes
227 views

I want to draw one of the first picture, but FastLineRenderableSeriesBuilder found no fill color Settings, do you have other solution?

Showing 1 - 50 of 122 results