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
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

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
7k 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 6 years ago
  • last active 6 years ago
0 votes
7k views

It seems most of the modifiers bring up tooltip data with a pan, and then it goes away when the user lifts their finger. Is there any way to bring up tooltip data with a tap (and does not go away when the finger has lifted)? The main problem that we’re trying to solve is that we would like to be able to pan to look at the chart (and don’t want an axis pan), but would also like to bring up tooltip data.

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)
1 vote
8k views

Purchased the license version of sci android for candle stick chart on xaxis zoom is not working it zooms on y axis help me out to fix this issue.

On xaxis zoom is incorrect with this method newCategoryDateAxis.

final IAxis xAxis = sciChartBuilder.newCategoryDateAxis().build();
final IAxis yAxis = sciChartBuilder.newNumericAxis().withGrowBy(new DoubleRange(0d, 0.1d)).build();

With newnumeric axis zoom is working fine as expected

final IAxis xAxis = sciChartBuilder.newNumericAxis().withAxisAlignment(AxisAlignment.Bottom).build();
final IAxis yAxis = sciChartBuilder.newNumericAxis().withGrowBy(new DoubleRange(0d, 0.1d)).build();

0 votes
9k views

On VS2017, in LineChartFragment.cs, I am trying to use VerticalSliceModifier, but it is not found.

var verticalSliceModifier = new VerticalSliceModifier();

Thank for your help.

0 votes
7k views

Hi,

I see there is spline interpolation for WPF https://www.scichart.com/documentation/v5.x/Spline%20Interpolation%20Filters.html is there a timeline for introducing this in the Android platform?

0 votes
9k views

In financial markets, there is a type of chart that is as follows.

I did not find this type of chart in SciChart.

Please help me how to draw this chart

0 votes
7k views

I see there is a Polar chart type for WPF charts and that one is “coming soon” to Android. Is it known when we can expect it to be available on Android?

Thank you in advance.

0 votes
6k views

do you have offline version of android charts.
my computer is not connected to the internet.
thanks

  • shay hadar asked 7 years ago
  • last active 7 years ago
0 votes
4k views

On Android, the docs say that AnnotationSurfaceEnum should have the “BelowChart” enum case, but it is actually missing in the code. It is there on iOS but not on Android.

I need this particular enum case, because otherwise the annotation boxes are hiding the data series and the grid lines.

What should I do?

  • Wil O asked 4 years ago
  • last active 4 years ago
0 votes
9k 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 3 years ago
  • last active 2 years ago
0 votes
14k views

Good morning,

I would like to ask you about the solution contained in the title. Is it possible to create realtime charts (for example 7-10) in a list (RecyclerView)? I have studied your example but there were none with a list.

The fragment in the example called createMultiPaneStockChartsFragment contains 4 charts. But unfortunately, it is not a list.
I made a simple activity with 5 charts in a RecyclerView, but charts are stucking a bit.
I do not call notify methods. There is only update LineData method:

oneChartClass.getLineData().append(oneChartClass.getLineData().getCount(), trendPoint.getValue());

Thanking you in advance…
Hubert

1 vote
9k views

Hello,

As you can see in the attached image, I’m using a Candlestick Chart for a financial application, but the gap between each bar on the chart is pretty small and it doesn’t look good.

I want to add a space between the bars but I couldn’t find how to do it. Can you help me?

Best regards.

0 votes
14k views

I am considering applying server-side licensing for my javerScript application.

In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support-dev.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)

However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)

I wonder if there is a sample code implemented in C++ for server-side licensing.

Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?

0 votes
5k views

I have a screen with multiple chart surfaces stacked on top of each other within a ScrollView. I can’t use a single chart surface because each of the charts is combined with other types of views to display extra information about the data in the charts.

I have a few issues I’m trying to solve:

  1. Each of the charts uses the same x-axis range. When a user pinches to zoom or drags to pan on a chart, I want all the charts to be synchronized to zoom and pan at the same time. How can I do this?

  2. Because the charts are embedded in a ScrollView, when I use the following modifiers it is very difficult to smoothly zoom and pan without the ScrollView being activated to scroll up and down. How can I make it so that the ScrollView is deactivated from moving while the user is attempting to zoom or pan a chart

surface.chartModifiers.add(
XAxisDragModifier().apply {
dragMode = AxisDragModifierBase.AxisDragMode.Pan
minTouchArea = 1000.0f
}
)
surface.chartModifiers.add(
PinchZoomModifier().apply {
direction = Direction2D.XDirection
}
)

0 votes
11k views

Hello,

I am trying to pass multiple custom symbols both (up and down arrows) on multipane stock chart in such a manner that green symbols should be below OHLC candle and red symbols above OHLC candles but I cannot place it in proper manner

Can anyone please help me out with how to give positioning on X axis as it is an year scale?

0 votes
10k 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 6 years ago
  • last active 6 years ago
0 votes
3k views

I am trying to make a custom Label Provider by extending NumericLabelProvider as it is described here:
https://www.scichart.com/documentation/android/current/webframe.html#Axis%20Labels%20-%20LabelProvider%20API.html

private class PercentLabelProvider : NumericLabelProvider
{
    public override string FormatLabel(Java.Lang.IComparable dataValue)
    {
        return string.Format("{0:P0}", dataValue);
    }
}

However, this is not possible, because FormatLabel can not be overridden.
This is the error message:
“cannot override inherited member ‘FormatterLabelProviderBase.FormatLabel(IComparable)’ because it is not marked virtual, abstract, or override”

DateLabelProvider has the same problem.

I need need to use both.

Is there a solution for this issue?

  • Wil O asked 4 years ago
  • last active 4 years ago
0 votes
11k views

Hi again,

Is it possible to move the rollover modifier without a touch when I know the x-axis and y-axis values?

At the moment user can tap the chart and the rollover modifier shows up and snaps to the closest point. Then I leave the rollover modifier visible by ignoring the onTouchUp() event. I have an external component that has the same data as the graph and now if user selects an item from that external component I would like to move the rollover modifier to that point. How can I do this?

1 vote
4k views

Hello,
I have a problem with the 3D surface chart. I have used the 3D example from the Example Tutorial as an example. As soon as I make xSize and ySize larger than 128, a gap appears in the respective axes.
Is it possible that these sizes are limited? Or have I made a mistake?

In the attachment you will find the resulting pictures.
The good one has an xSize and ySize of 128 and the bad one 129.

0 votes
11k views

Dear All,

I would like to ask are there any method to draw a line (or annotation) by user touch event ?

For example user touch the chart to set the starting point of the line and then touch/drag to another point to draw the line.

Thanks.

  • Ray Hung asked 7 years ago
  • last active 5 years ago
0 votes
10k 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 6 years ago
  • last active 6 years ago
0 votes
6k views

I see that this can be done on WPF (using ShowLicensingWarnings), but couldn’t find the property on Android. How can the licensing warning be hidden on Android?

  • Mike Liu asked 6 years ago
  • last active 6 years ago
0 votes
10k views

Hello

I was wondering if it would be possible to create a simple clean looking chart like described in the attached image. I am looking for a “SuccessRateChart” that has some similarity to the PieChart but does not use the whole circle to describe its content. I would also need a way to adjust the visible radius of the Pie. In means of information visualization you often hear the term “doughnut chart”…

On way could be to draw some circle stacked over the chart itself, but there should be a better solution.

Would love to hear from you,

Kind regards,
Stephan

0 votes
14k views

I have created a HeatMap with the size of 25000 x 70. The application crashes with the following log:

E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
I/OpenGLRenderer: Initialized EGL, version 1.4
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without…
D/EGL_emulation: eglCreateContext: 0x7faef90b6500: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0x7faef90b6500: ver 2 0 (tinfo 0x7faf0489eec0)
D/EGL_emulation: eglMakeCurrent: 0x7faef90b6500: ver 2 0 (tinfo 0x7faf0489eec0)
D/EGL_emulation: eglCreateContext: 0x7faf04b65680: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0x7faf04b65680: ver 2 0 (tinfo 0x7faf04b7e500)
E/emuglGLESv2_enc: device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glTexImage2D:1908 GL error 0x501 A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x41a10f90 in tid 2736 (GLThread 973)


Below is Kotlin code from my sample project that produces the error:

private const val WIDTH = 25000
private const val HEIGHT = 70

class MainActivity : AppCompatActivity()
{
    private lateinit var chartBuilder: SciChartBuilder

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

        SciChartSurface.setRuntimeLicenseKey(getString(R.string.sciChart_license))
        SciChartBuilder.init(this)
        chartBuilder = SciChartBuilder.instance()

        setContentView(R.layout.activity_main)
        val background = findViewById<ViewGroup>(R.id.background)

        val chartSurface = createChartSurface()
        background.addView(chartSurface)

        addPoints(chartSurface)
    }

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

        val xAxis = chartBuilder.newNumericAxis().build()
        val yAxis = chartBuilder.newNumericAxis().build()

        surface.xAxes.add(xAxis)
        surface.yAxes.add(yAxis)

        surface.renderableSeries.add(createSeries(WIDTH, HEIGHT))

        return surface
    }

    private fun createSeries(width: Int, height: Int): FastUniformHeatmapRenderableSeries
    {
        val dataSeries = UniformHeatmapDataSeries(Int::class.javaObjectType, Int::class.javaObjectType, Float::class.javaObjectType, width, height)

        return chartBuilder.newUniformHeatmap()
            .withColorMap(ColorMap(intArrayOf(ColorUtil.DarkBlue, ColorUtil.CornflowerBlue, ColorUtil.DarkGreen, ColorUtil.Chartreuse, ColorUtil.Yellow, ColorUtil.Red), floatArrayOf(0f, 0.2f, 0.4f, 0.6f, 0.8f, 1f)))
            .withDataSeries(dataSeries)
            .build()
    }

    private fun addPoints(chartSurface: SciChartSurface)
    {
        @Suppress("UNCHECKED_CAST")
        val dataSeries = chartSurface.renderableSeries.first().dataSeries as UniformHeatmapDataSeries<Int, Int, Float>

        val xRange = 0 until WIDTH

        for (i in 0 until HEIGHT)
        {
            val values = xRange.map { (i + it).toFloat() }
            dataSeries.updateRangeZAt(0, i, values)
        }

        val renderableSeries = chartSurface.renderableSeries.first() as FastUniformHeatmapRenderableSeries
        renderableSeries.minimum = dataSeries.zValues.minimum.toDouble()
        renderableSeries.maximum = dataSeries.zValues.maximum.toDouble()
    }
}
0 votes
7k views

final IAxis yAxis = sciChartBuilder.newNumericAxis()
.withAxisAlignment(AxisAlignment.Bottom)
.withFlipCoordinates(true)
.build();
final IAxis xAxis = sciChartBuilder.newNumericAxis()
.withAxisAlignment(AxisAlignment.Left)
.withFlipCoordinates(true)
.build();
Collections.addAll(surface.getYAxes(), yAxis);
Collections.addAll(surface.getXAxes(), xAxis);
surface.getChartModifiers().add(new RolloverModifier());

In this case rollover modifier will only catch the very first point of line series.

1 vote
6k views

Hello, we are developing a finance application that contains sciChart. Our main chart and optionally RSI, MACD etc. There are indicators. I want the user to screenshot and share the graph and the indicators, but I’m having trouble doing this. Although I tried more than one way for this, I encountered different problems in all of them.
First of all, I take a screenshot with the createBitmap and Canvas method of the Layout where my graphics are located, but the graphic contents are not visible in the screenshot content.
As the second method, I tried the exportToBitmap method in sciChart, but here I only take a screenshot of 1 chart, I cannot take a screenshot of a graph + RSI + MACD at the same time. As another problem, the opening, closing, high, etc. of the parity on the chart. The texts containing the data are not visible in the screenshot.

Below I will share the screenshots I took with both the first method and the second method, the image on the phone at that moment, and the codes I used.
What I wanted to use was to take a screenshot of more than one graph and the data on it at the same time as in the first method. How can I do that?

Method 1

Bitmap bitmap = Bitmap.createBitmap(view.getWidth(),
            view.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    view.draw(canvas);

Method 2

surface.exportToBitmap()
1 vote
910 views

I applied alpha color to FastLineRenderableSeries, but it was not visible. On the other hand, FastColumnRenderableSeries works well with alpha color. Please check the issue.

Example Code

class AlphaChart {
    private val colorAlpha00 = ColorUtil.argb(0x00, 0xFF, 0xCC, 0x80) // 0%
    private val colorAlpha1A = ColorUtil.argb(0x1A, 0xFF, 0xCC, 0x80) // 10%
    private val colorAlpha33 = ColorUtil.argb(0x33, 0xFF, 0xCC, 0x80) // 20%
    private val colorAlpha4D = ColorUtil.argb(0x4D, 0xFF, 0xCC, 0x80) // 30%
    private val colorAlpha66 = ColorUtil.argb(0x66, 0xFF, 0xCC, 0x80) // 40%
    private val colorAlpha80 = ColorUtil.argb(0x80, 0xFF, 0xCC, 0x80) // 50%
    private val colorAlpha99 = ColorUtil.argb(0x99, 0xFF, 0xCC, 0x80) // 60%
    private val colorAlphaB3 = ColorUtil.argb(0xB3, 0xFF, 0xCC, 0x80) // 70%
    private val colorAlphaCC = ColorUtil.argb(0xCC, 0xFF, 0xCC, 0x80) // 80%
    private val colorAlphaE6 = ColorUtil.argb(0xE6, 0xFF, 0xCC, 0x80) // 90%
    private val colorAlphaFF = ColorUtil.argb(0xFF, 0xFF, 0xCC, 0x80) // 100%

    fun initAlphaChart(surface: SciChartSurface) {
        surface.suspendUpdates {
            theme = R.style.SciChart_Alpha

            xAxes {
                numericAxis {
                    autoRange = AutoRange.Always
                    growBy = DoubleRange(0.1, 0.1)
                }
            }
            yAxes {
                numericAxis {
                    autoRange = AutoRange.Always
                    growBy = DoubleRange(0.2, 0.2)
                }
            }
            renderableSeries {
                fastColumnRenderableSeries {
                    dataSeries = createDataSeries(2.0)
                    paletteProvider = AlphaPaletteProvider()
                }
                fastLineRenderableSeries {
                    dataSeries = createDataSeries(3.0)
                    strokeStyle = SolidPenStyle(colorAlpha00, 2f) // 0% - Not Visible
                }
                fastLineRenderableSeries {
                    dataSeries = createDataSeries(3.1)
                    strokeStyle = SolidPenStyle(colorAlpha1A, 2f) // 10% - Not Visible
                }
                fastLineRenderableSeries {
                    dataSeries = createDataSeries(3.2)
                    strokeStyle = SolidPenStyle(colorAlpha33, 2f) // 20% - Not Visible
                }
                fastLineRenderableSeries {
                    dataSeries = createDataSeries(3.3)
                    strokeStyle = SolidPenStyle(colorAlpha4D, 2f) // 30% - Not Visible
                }
                fastLineRenderableSeries {
                    dataSeries = createDataSeries(3.4)
                    strokeStyle = SolidPenStyle(colorAlpha66, 2f) // 40% - Not Visible
                }
                fastLineRenderableSeries {
                    dataSeries = createDataSeries(3.5)
                    strokeStyle = SolidPenStyle(colorAlpha80, 2f) // 50% - Not Visible
                }
                fastLineRenderableSeries {
                    dataSeries = createDataSeries(3.6)
                    strokeStyle = SolidPenStyle(colorAlpha99, 2f) // 60% - Not Visible
                }
                fastLineRenderableSeries {
                    dataSeries = createDataSeries(3.7)
                    strokeStyle = SolidPenStyle(colorAlphaB3, 2f) // 70%
                }
                fastLineRenderableSeries {
                    dataSeries = createDataSeries(3.8)
                    strokeStyle = SolidPenStyle(colorAlphaCC, 2f) // 80%
                }
                fastLineRenderableSeries {
                    dataSeries = createDataSeries(3.9)
                    strokeStyle = SolidPenStyle(colorAlphaE6, 2f) // 90%
                }
                fastLineRenderableSeries {
                    dataSeries = createDataSeries(4.0)
                    strokeStyle = SolidPenStyle(colorAlphaFF, 2f) // 100%
                }
            }
            chartModifiers {
                rolloverModifier {}
            }
        }
    }

    private fun createDataSeries(yValues: Double): XyDataSeries<Int, Double> {
        return XyDataSeries<Int, Double>().apply {
            for (index in 1..10) {
                append(index, yValues)
            }
        }
    }
}


class AlphaPaletteProvider :
    PaletteProviderBase<FastColumnRenderableSeries>(FastColumnRenderableSeries::class.java),
    IFillPaletteProvider, IStrokePaletteProvider {
    private val colorAlpha00 = ColorUtil.argb(0x00, 0xFF, 0xCC, 0x80) // 0%
    private val colorAlpha1A = ColorUtil.argb(0x1A, 0xFF, 0xCC, 0x80) // 10%
    private val colorAlpha33 = ColorUtil.argb(0x33, 0xFF, 0xCC, 0x80) // 20%
    private val colorAlpha4D = ColorUtil.argb(0x4D, 0xFF, 0xCC, 0x80) // 30%
    private val colorAlpha66 = ColorUtil.argb(0x66, 0xFF, 0xCC, 0x80) // 40%
    private val colorAlpha80 = ColorUtil.argb(0x80, 0xFF, 0xCC, 0x80) // 50%
    private val colorAlpha99 = ColorUtil.argb(0x99, 0xFF, 0xCC, 0x80) // 60%
    private val colorAlphaB3 = ColorUtil.argb(0xB3, 0xFF, 0xCC, 0x80) // 70%
    private val colorAlphaCC = ColorUtil.argb(0xCC, 0xFF, 0xCC, 0x80) // 80%
    private val colorAlphaE6 = ColorUtil.argb(0xE6, 0xFF, 0xCC, 0x80) // 90%
    private val colorAlphaFF = ColorUtil.argb(0xFF, 0xFF, 0xCC, 0x80) // 100%

    private val colors = IntegerValues(
        intArrayOf(
            colorAlpha00,
            colorAlpha1A,
            colorAlpha33,
            colorAlpha4D,
            colorAlpha66,
            colorAlpha80,
            colorAlpha99,
            colorAlphaB3,
            colorAlphaCC,
            colorAlphaE6,
            colorAlphaFF
        )
    )

    override fun update() {}

    override fun getFillColors(): IntegerValues = colors

    override fun getStrokeColors(): IntegerValues = colors
}
0 votes
4k views

We are working on line charts in Xamarin forms. We have a requirement to zoom in only one direction at one time. Once the user is done with zooming in one direction (say horizontal) and he reaches that place through scrolling, he should be able to zoom in another direction(vertical). Can you please assist this for the same

  • george asked 5 years ago
  • last active 5 years ago
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
11k views

Hello, for my bottom graph on my screenshot below, is it possible to dynamically change the black background to red? Indeed, when the microphone saturates like on the screenshot below I want to change the black background to red for 2 seconds, so I need to do it programmatically.

https://i.ibb.co/7XCLDwf/sature.png

I init my bottom graph like this :

 @Override
    public void initGraph(Context context) {
        Log.d(TAG, "initGraphs");
        SciChartSurface audioStreamSciChart = new SciChartSurface(context);
        mAudiostream.addView(audioStreamSciChart);
        xAxis = new NumericAxis(context);
        xAxis.setVisibleRange(new DoubleRange(startAudioStreamRange, endAudioStreamRange));
        xAxis.setDrawLabels(false);
        xAxis.setDrawMinorTicks(false);
        xAxis.setDrawMajorBands(false);
        xAxis.setDrawMinorGridLines(false);
        audioStreamSciChart.getXAxes().add(xAxis);

        NumericAxis yAxis = new NumericAxis(context);
        yAxis.setVisibleRange(new DoubleRange(-1.0, 1.0));
        yAxis.setDrawLabels(true);
        yAxis.setDrawMinorTicks(false);
        yAxis.setDrawMajorBands(false);
        yAxis.setDrawMinorGridLines(false);
        yAxis.setAxisAlignment(AxisAlignment.Left);

        audioStreamSciChart.getYAxes().add(yAxis);

        float lineThickness = SciChartExtensionsKt.dip(context, 1.0F);

        FastLineRenderableSeries f = new FastLineRenderableSeries();
        f.setDataSeries(scichartTools.getAudioDS());
        f.setStrokeStyle(new SolidPenStyle(ColorUtil.Grey, true, lineThickness, null));
        audioStreamSciChart.getRenderableSeries().add(f);
        scichartLayout = mAudiostream.getChildAt(0);
    }

I can keep a reference of my FastLineRenderableSeries to do it but i didn’t find any method to change his backgroud color.
Can i ?

Thanks,
Wavely

1 vote
11k views

Hello,

I am trying to add series to a linechart, however I seem to be unable to create a XyDataSeries in Kotlin I have tried the following:

private val linedata = XyDataSeries<Double, Double>().apply { fifoCapacity = FIFO_CAPACITY } 

// like from the ECG showcase example, this gives the error 
// "none of the functions can be called with the arguments called"

private val linedata2 : IXyDataSeries<Double, Double> =  XyDataSeries(Double.class, Double.class)

private var linedata3 : XyDataSeries<Double, Double> = XyDataSeries(Integer.class, Double.class).build()

This seems quite straightforward but I am unable to find a solution. Can you help me?

Kind regards,
Bart

0 votes
9k views

I want to display auto format date on xAxis (DateAxis) while zooming but I cannot find SubDayTextFormatting function.Is there any way to display minutes and seconds after init months ?there is no DateTime Axis on Android like on iOS ..Should I change to CategoryDate Axis?

Thanks in advance

  • Guest asked 8 years ago
  • last active 9 months ago
0 votes
5k views

How to position the legend in the botton of chart and make 2 column foreach tag?

0 votes
8k views

Hi, i am developping a spectogram, screenshot : https://i.ibb.co/7CPTZbg/screenshot-framed.png

I get the same result from your showcase, now there is some things i want to change but can’t resolve to know how to :
– How can i change data direction to spread from left to right ? (currently right to left)
– How can i clear FastUniformHeatmapRenderableSeries ? Method clear doesn’t work
– How can we set width of FastUniformHeatmapRenderableSeries’s layout to be fixed to a specific seconds number ? (example : there is 10 seconds of data between left and right)

Thank you,
Wavely

0 votes
5k views

Hi,

How can i get to first and last items indexes on visible range when onVisibleRangeChanged triggered?

Tnx.

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
7k views

Hi,

I am trying to add text annotation on the chart but it doesn’t show. I’m wondering what went wrong with my code.

TextAnnotation textAnnotation = sciChartBuilder.newTextAnnotation()
                .withText("hello")
                .withX1(450)
                .withY1(1)
                .withFontStyle(20, Color.WHITE)
                .build();
        ecgSurface.getAnnotations().add(textAnnotation);
  • Gang Xu asked 3 years ago
  • last active 3 years ago
0 votes
5k views

Hello!
There is interesting situation when I’m trying to show volumes on charts in my application. On the first screen you can see that on the left side of the image there is height values of volumes (the data is between 2.000.000 and 5.000.000), on the other side are low (they are between 0 and 100.000 in true values and hardcoded in my sample). It looks like correct because of low vaues, but when i’m scrolling screen to the later data (seconds screenshot), it “jumps” and displays with full-size (on image I’m hardcoded values for 3.000.000, so that’s why they are equals).
When data is hardcoded for 3.000.000 I think it should be closer to the preveous “true” values which are on the left side, but they are not.
It looks like the bottom side of the candles extruding them.
What is the reason of this behaviour? How can I correctly display this data?

Thank you!

1 vote
13k views

Hello,

I have this app : https://i.ibb.co/sPXMbf1/screenshot-framed-1.png

I would like the graph below (the XyDataSeries) to be drawn from right to left (currently it is drawn from left to right)

I have this function to draw :

val audioDS = XyDataSeries<Int, Short>().apply { fifoCapacity = audioStreamBufferSize }
fun generateAudioStream(buffer: ShortValues) {
           val longs = IntegerValues(buffer.size())
           longs.setSize(buffer.size())
           for (i in 0 until buffer.size()) {
               longs[i] = time++
           }
           audioDS.append(longs, buffer)
        }

And my graph is initialized like this :

 @Override
public void initGraph(Context context) {
    Log.d(TAG, "initGraphs");
    SciChartSurface audioStreamSciChart = new SciChartSurface(context);
    mAudiostream.addView(audioStreamSciChart);
    xAxis = new NumericAxis(context);
    xAxis.setVisibleRange(new DoubleRange(startAudioStreamRange, endAudioStreamRange));
    xAxis.setDrawLabels(false);
    xAxis.setDrawMinorTicks(false);
    xAxis.setDrawMajorBands(false);
    xAxis.setDrawMinorGridLines(false);
    audioStreamSciChart.getXAxes().add(xAxis);

    NumericAxis yAxis = new NumericAxis(context);
    yAxis.setVisibleRange(new DoubleRange(new DoubleRange((double) Short.MIN_VALUE, (double) Short.MAX_VALUE)));
    yAxis.setDrawLabels(true);
    yAxis.setDrawMinorTicks(false);
    yAxis.setDrawMajorBands(false);
    yAxis.setDrawMinorGridLines(false);
    yAxis.setAxisAlignment(AxisAlignment.Left);

    audioStreamSciChart.getYAxes().add(yAxis);

    float lineThickness = SciChartExtensionsKt.dip(context, 1.0F);

    FastLineRenderableSeries f = new FastLineRenderableSeries();
    f.setDataSeries(scichartTools.getAudioDS());
    f.setStrokeStyle(new SolidPenStyle(ColorUtil.Grey, true, lineThickness, null));
    audioStreamSciChart.getRenderableSeries().add(f);
    scichartLayout = mAudiostream.getChildAt(0);
}

I understand that, currently it’s drawn from left to right because i append data on my audioDS, is it possible to make it draw from right to left instead ?

Best regards,
Wavely

0 votes
4k views

Hi,

I was using android sdk 2.5 and i’m not getting any runtime errors and error logs. But after updating the project to sdk 3.0 i started getting errors (no code has been changed). During the runtime, chart’s xAxis shows wrong times and started writing 1970 under every vertical grid line. Also debug log says: “SciChartSurface has no XAxes. Please ensure SciChartSurface.XAxis is set, or SciChartSurface.XAxes has at least one axis”.

I’m just upgrade sdk 2.5 to 3.0, how can i fix errors?

Tnx.

0 votes
9k views

I have created a SciChartSurface with the width of 200 px. I have created a data series with data that corresponds to four vertical lines at 0 %, 25 %, 50 % and 75 % of width. When I set the data series’ width to 115 points all four vertical lines are clearly visible. However when I set the width to 116 points or more, the first line (at x == 0) disappears. Data series is still smaller than the renderable series width in px, so there is no reason for any of the vertical lines to go missing. Is this a bug, or did I configure something wrong?

Here is the xml layout:

<com.scichart.charting.visuals.SciChartSurface
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/chart"
    android:layout_width="200px"
    android:layout_height="match_parent"/>

Here is the code for MainActivity:

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.scichart.charting.model.dataSeries.UniformHeatmapDataSeries
import com.scichart.charting.visuals.SciChartSurface
import com.scichart.charting.visuals.renderableSeries.ColorMap
import com.scichart.drawing.utility.ColorUtil
import com.scichart.extensions.builders.SciChartBuilder
import kotlin.math.roundToInt

const val WIDTH = 116
const val HEIGHT = 50

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

        SciChartSurface.setRuntimeLicenseKey(getString(R.string.sciChart_license))
        SciChartBuilder.init(this)

        setContentView(R.layout.activity_main)

        val chartSurface = findViewById<SciChartSurface>(R.id.chart)
        val chartBuilder = SciChartBuilder.instance()

        val xAxis = chartBuilder.newNumericAxis().build()
        val yAxis = chartBuilder.newNumericAxis().build()

        val dataSeries = UniformHeatmapDataSeries<Int, Int, Int>(Int::class.javaObjectType, Int::class.javaObjectType, Int::class.javaObjectType, WIDTH, HEIGHT)
        for (x in 0 until WIDTH)
        {
            for (y in 0 until HEIGHT)
            {
                val value = when (x)
                {
                    0,
                    (0.25 * WIDTH).roundToInt(),
                    (0.5 * WIDTH).roundToInt(),
                    (0.75 * WIDTH).roundToInt() -> 50
                    else                        -> 0
                }
                dataSeries.updateZAt(x, y, value)
            }
        }

        val series = chartBuilder.newUniformHeatmap()
            .withColorMap(ColorMap(intArrayOf(ColorUtil.DarkBlue, ColorUtil.CornflowerBlue, ColorUtil.DarkGreen, ColorUtil.Chartreuse, ColorUtil.Yellow, ColorUtil.Red), floatArrayOf(0f, 0.2f, 0.4f, 0.6f, 0.8f, 1f)))
            .withDataSeries(dataSeries)
            .build()

        chartSurface.suspendUpdates().use {
            chartSurface.xAxes.add(xAxis)
            chartSurface.yAxes.add(yAxis)
            chartSurface.renderableSeries.add(series)
        }
    }
}
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
    )
}
1 vote
11k views

I’m trying to implement sciChart to flutter app (Android). It gets pretty confusing when trying to make it work. Anyone have examples how to make SciChart to work on Flutter? Adding the license works just fine. Only need for ECG chart for now. Thanks.

1 vote
7k views

When displaying data in the chart, the data will not start at the beginning/left of the chart, but there is a margin.
How can I set this margin to 0 so the data will be displayed directly after the left yAxis.
The same margin is also at the right of the chart. I also would like a much smaller margin there.

Thanks….

  • EJansen asked 8 years ago
  • last active 8 years ago
0 votes
9k views

I hope you can help me I have managed to change the font color, size, but I do not know how to put the annotation with underlined font, who could give me a clue please. I would like to get something like what is shown in the image I attached. Thanks in advance.

1 vote
8k views

When I insert a series of data (more than 100 data)into the graph, the application crashes
Source code is as follows

    ma5Series.insertRange(0,date,ma5Y);
    ma10Series.insertRange(0,date,ma10Y);
    ma20Series.insertRange(0,date,ma20Y);
    macdSlowSeries.insertRange(0,date,macdFast,macdSlow);
    macdSignalSeries.insertRange(0,date,macdSignal);

The error is as follows

java.lang.UnsupportedOperationException: Data has been changed to a DataSeries which is unsorted in the X-Direction. Unsorted data can have severe performance implications in SciChart.

For maximum performance, please double-check that you are only inserting sorted data to SciChart. Alternatively, to disable this warning and allow unsorted data, please call dataSeries.setAcceptsUnsortedData(true).

I set up “dataSeries.setAcceptsUnsortedData (true)”, but still reported wrong.
how to solve it?

Showing 101 - 150 of 473 results