SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
We are working on an android based ELD application. We are looking for a ELD graph. Is it possible to accomplish this using SCICHART?
Hello there,
I am testing your 3D chart by creating single chart and adding multi data on condition.Whenever adding new data I clear previous.
surfaceCommon3D.getRenderableSeries().clear();
surfaceCommon3D.getChartModifiers().clear();
Issues is when first data add tooltip working properly and after adding new data then checking tooltip value Application will crash and show this error:
java.lang.ArrayIndexOutOfBoundsException: index
at com.scichart.core.model.DoubleValues.get(SourceFile:6)
at com.scichart.charting3d.visuals.renderableSeries.hitTest.MeshSeriesInfo3D.update(SourceFile:10)
here is my tooltip snippet code:
TooltipModifier3D t1 = new TooltipModifier3D();
t1.setReceiveHandledEvents(true);
t1.setExecuteOnPointerCount(1);
surfaceCommon3D.getChartModifiers().add(new ModifierGroup3D(t1));
SurfaceMeshRenderableSeries3D snippet code:
rs = sciChart3DBuilder.newSurfaceMeshSeries3D()
.withDataSeries(ds)
.withDrawMeshAs(DrawMeshAs.SolidWireframe)
.withStroke(blackColor)
.withContourStroke(stroke)
.withStrokeThicknes(1f)
.withDrawSkirt(false)
.withMeshColorPalette(new GradientColorPalette(colors, stops))
.withMetadataProvider(new SurfaceMeshMetadataProvider3D(pnl_time_spot_Z_3d, xSize, “common3DChartLayout”))
.withSeriesInfoProvider(new CustomSeriesInfo3DProvider1(fromModel, xSize))
.build();
UpdateSuspender.using(surfaceCommon3D, new Runnable() {
@Override
public void run() {
surfaceCommon3D.setCamera(camera);
surfaceCommon3D.setXAxis(xAxis);
surfaceCommon3D.setYAxis(yAxis);
surfaceCommon3D.setZAxis(zAxis);
surfaceCommon3D.getRenderableSeries().add(rs);
surfaceCommon3D.invalidate();
}
});
I am Requesting you to solved my issues ASAP.
Thanks in Advance
Hello there,
I am testing your 3d chart in demo project but I added X,Y and Z data, also added tool-tip to check the value
final TooltipModifier3D tooltipModifier3D = new TooltipModifier3D();
tooltipModifier3D.setIsEnabled(true);
tooltipModifier3D.setMarkerPlacement(Placement.TopRight);
tooltipModifier3D.setExecuteOnPointerCount(1);
tooltipModifier3D.setCrosshairMode(CrosshairMode.Lines);
surfaceCommon3D.getChartModifiers().add(tooltipModifier3D);
And also implement custom tool-tip UI.
The Issues is when I hover cursor on chart it not showing exact position on tool-tip. I attach SS png you can check it,
SS showing my cursor is on position x=6 but on tooltip it showing x=2.Waiting for your reply.
Thanks You
I want to make my labels positions in the centre of axis (y axis which is transparent). Only three labels have to be showed. On the same height with the min, max and actual points. How can I achieve this.
Hello there,
I am testing SciChartSurface3D its working fine but when I do some changes with height in chart layout it not render properly and getting error:
E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xeb0966f0
E/emuglGLESv2_enc: Out of bounds vertex attribute info: clientArray? 1 attribute 1 vbo 129 allocedBufferSize 672 bufferDataSpecified? 1 wantedStart 0 wantedEnd 889012
I am requesting to please check this error.
We are using single SurfaceMeshRenderableSeries3D chart and added multidata on condition click event but issue is sometime data is loaded or sometime not. So my question is how to refresh 3D chart after added new data ?
Hello,
At right chart we have show only one X-axis which needs to update in real time .whenever new values will come we have to update in X-axis in itself instead of adding new line at X-Axis.
Each time New Y – axis will come that will append at left chart (Can be consider left chart showing history of right chart)
Let me know if anything further requred
Thanks.
Hello Friends ,
Sync two Chart in Android Bottom chart can be change on top chart touch
We are looking a solution where we want show two chart at Top and Bottom in Android Screen.based on Top chart changed by gesture /finger touch should be expend/shrink like zoom in and out bottom chart
Assume at top chart data range has between 0 to 3,00,000 , I want to capture in bottom chart only selected/touched part in with expanded form.
I have attached below screen shot which may be helpful.
Solution can be like this but not able to get code for this implementation
https://blog.scichart.com/content/images/2021/06/Navigate-ECG-strip-with-Pocket-ECM.gif
https://blog.scichart.com/android-app-to-view-long-term-ecg-signals/
I appreciate any help regarding this issue.
Hello Friends,
I'm looking a solution where i can change Y-Axis range in between (0.1,0.2,0.4,0.6,0.8,1.0) .
I appreciate any help for above question
Thanks
Vasim
Hi,
Can you please tell me do you have tool like https://www.scichart.com/documentation/win/current/webframe.html#Fibonacci%20Retracement%20Drawing%20Tool.html
on Android?
If not, please give me a sample code on how to implement this with scichart.
Thanks in advance.
Regards,
Batyr
I would like to add scroll listener on x axis title. Is it possible to add scroll to axis title
I try to make a text formatting for my chart on IOS and Android, regarding your documentation:
IOS:
https://www.scichart.com/documentation/ios/current/axis-labels—textformatting-and-cursortextformatting.html
yAxis.textFormatting = “$0.0”
Android:
https://www.scichart.com/documentation/android/current/Axis%20Labels%20-%20TextFormatting%20and%20CursorTextFormatting.html
yAxis.setTextFormatting(“$0.0000”);
I checked my code and its the same like yours. On Android i have:
// yAxis filed with type IAxis
private IAxis yAxis;
// create
yAxis = sciChartBuilder
.newNumericAxis()
.withGrowBy(0.01d, 0.1d)
.withDrawLabels(true)
.withDrawMajorGridLines(true)
.withDrawMinorGridLines(false)
.withDrawMajorBands(false)
.withDrawMajorTicks(false)
.build();
// the set textFormatting:
yAxis.setTextFormatting(“$0.0000”);
On IOS i have:
var yAxis: SCINumericAxis?
self.yAxis = SCINumericAxis()
self.yAxis?.textFormatting = “$0.0”
But it is not working, can you tell me please why? What I’m doing wrong?
Hi,
I want to change the colormap so that the:
– minimum (blue) = 4095
– maximum (red) = 800
Also, I want to set 0 to either black or transparent.
I can easily change the min and max values, just wanting to change the color limit and set 0 = black.
Here is my code for creating the heatmap:
public void heatmap(){
// Create a SciChartSurface
SciChartSurface surface = new SciChartSurface(this);
// Get a layout declared in "activity_main.xml" by id
LinearLayout chartLayout = findViewById(R.id.chart_layout);
// Add the SciChartSurface to the layout
chartLayout.addView(surface);
// Initialize the SciChartBuilder
SciChartBuilder.init(this);
// Obtain the SciChartBuilder instance
final SciChartBuilder sciChartBuilder = SciChartBuilder.instance();
final NumericAxis xAxis = sciChartBuilder.newNumericAxis()
.withGrowBy(0.1, 0.1)
.build();
final NumericAxis yAxis = sciChartBuilder.newNumericAxis()
.withGrowBy(0.1, 0.1)
.build();
final FastUniformHeatmapRenderableSeries heatmapRenderableSeries = sciChartBuilder.newUniformHeatmap()
.withMinimum(4095)
.withMaximum(800)
.withCellTextStyle(sciChartBuilder.newFont().withTextSize(8).withTextColor(ColorUtil.White).build())
.withDrawTextInCell(true)
.withDataSeries(createDataSeries())
.build();
final SciChartSurface chart = surface;
Collections.addAll(chart.getXAxes(), xAxis);
Collections.addAll(chart.getYAxes(), yAxis);
Collections.addAll(chart.getRenderableSeries(), heatmapRenderableSeries);
Collections.addAll(chart.getChartModifiers(), sciChartBuilder.newModifierGroupWithDefaultModifiers().build());
}
i have been working on line charts and i need to show date as well as time on the axis( 21 june 08 05:30:PM like this).I’ve tried with date axis and numeric axis ,but it doesn’t helps.Do we have any suggestions or samples which could help me
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.
I have a line chart and need to implement textAlign: left property for tickLabel on yAxis. I have found some way to do it on the forum, but it does not work in my case:
xAxis.setAxisTickLabelStyle(new AxisTickLabelStyle(Gravity.CENTER, Layout.Alignment.ALIGN_CENTER, 5, 0, 5, 0));
I get the error:
Alignment cannot be converted to int
But according documentation https://www.scichart.com/documentation/android/current/SciChart.Charting~com.scichart.charting.visuals.axes.AxisTickLabelStyle~_ctor.html AxisTickLabelStyle class get 5 int arguments. Can you help me please how to solve it!
Hi
Sometimes when I call annotation.setIsHidden in a surface with RenderSurfaceGl, not works.
what should I do?
I’m evaluating chart libraries to my next project and I’m trying to do a simple chart like the one in the attached image.
It was actually very easy to do it using MPAndroidChart, however it’s been hard to do a simple task like put a label aligned with the column… I did take a look into the SciChart sample application, but the application just uses numeric labels…
Can someone provide some guidance of how to do this?
Hello!
I’m trying to migrate OhlcDataSeries from Double to more accurate BigDecimal on Android.
But I faced with an issue that “GenericClass doesn’t support class”
How can I fix it?
I want to use BigDecimal with chart.
Thank you
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.
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:
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)
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
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?
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.
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.
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.
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.
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();
}
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?
I have two questions on rollover modifier.
One is the tooltip of the rollover is right under the finger on a heatmap chart. Can I move it to the top left section of the touch point?
Second question is how can I implement a callback function whenever Y axis of the rollover modifier changes?
Thanks for your attention in advance.
Hi, I want to draw a chart like the attached image.
This is a chart with XyDataSeries, it show as vertical line at each data point and verticle line is a dotted line in order to separated from other series.
Since the OHLC chart will have the open, close on the data point and an impulse chart is forced to draw from an axis, is there any better way that can achieve a series like this? Thank you!
I set a rolloverModifier to a CandlestickSeries, but I can not find a API to hide RolloverMarker,I only find a article about WPF(https://www.scichart.com/documentation/v5.x/webframe.html#RolloverModifier.html), how could I hide RolloverMarker or change the style of RolloverMarker in Android?
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
Hello,
Let me first describe the issue we have and why I think a possible solution would be to catch the double tap event.
Our chart consists of 6 series. We have an X axis that shows timestamps and 5 Y axis’ for different data like pressure value, temperature, etc. which are of type double. Additionally under the chart we have a legend that displays these 5 Y axis series (one series per one Y axis) with ability to change the visibility of the series and axis.
The problem occurred when as an example, temperature values throughout are constant, e.g. 24.5. The line gets drawn and it is a stable line. Axis is also displayed. However, when a user does the double tap gesture on the chart surface, which usually resets the zoom extents, the axis that has static/non-changing values does some sort of re-initialize animation and after several of double tab gestures only axis label remains (minor and major ticks disappear).
If I could catch the double tap gesture event and override it I could for example say that if the data is static don’t do anything. However, I don’t know where this event is and how to override it.
Any help would be much appreciated.
Thank you.
Regards,
Paul.
Hello.
I am working on Xamarin Android project with C#. Since having a legend within the chart causes problems with too many axis’ (no scrolling is available thus selecting different series in a legend becomes unavailable) and having a legend outside of chart area, anywhere we desire, would be of a preference, is there a tutorial on how could I achieve such a thing? Our project needs this functionality for both Android and iOS.
Would be grateful if anyone could help out with this issue.
Thank you in advance!
How to create the order book depth chart with SciChart?
Hello there,
I’m trying to implement adding line annotation on touch, but this causes crash.
I’m watching example android app in fragment CreateAnnotationsDynamicallyFragment.
I guess, it should be very easy, but example uses data binding and part of code is hidden somewhere + source code is obfuscated, so it’s hard for me to understand what is wrong.
Can someone give a short example of how to add annotation on touch?
Thanks
Exception:
Process: process_name, PID: 24978
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Comparable com.scichart.charting.visuals.axes.IAxis.getDataValue(float)' on a null object reference
at com.scichart.charting.modifiers.AnnotationCreationModifier.a(SourceFile:203)
at com.scichart.charting.modifiers.AnnotationCreationModifier.onTouchDown(SourceFile:155)
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
So I am trying to set paddings on the chart, so that the data series do not touch chart edges
I can’t do it with View’s method setPadding because then the black background is present (screenshot shows padding on all sides but I need just left and right)
Also, I managed to achieve no labels, axes, grids etc. but in totally hacky way; I set .withIsCenterAxis and then all other things to false
.withAxisId(Y_AXIS_ID)
.withDrawMajorBands(false)
.withDrawMajorGridLines(false)
.withDrawMinorGridLines(false)
.withDrawLabels(false)
.withIsCenterAxis(true)
.withDrawMajorTicks(false)
.withDrawMinorTicks(false)
Is there a normal way of doing this?
thanks
Hi all,
Why the API’s for iOS, Android and WPF are not identically?
I have seen many samples on the forum, but to adapt it to a different platform is very hard.
A lot of classes are different for each platform.
Regards
Urs
Hi, i want to make something like that : https://i.ibb.co/617TmD2/screenshot-line.png
I have tried HorizontalLineAnnotation but i successed to have it only on bottom graph : https://i.ibb.co/qsCjjGd/screen-bot-graph.png
Here how i initialize my top graph :
@Override
public void initGraph(Context context) {
Log.d(TAG, "initGraphs");
SciChartSurface spectogramSciChart = new SciChartSurface(context);
spectogram.addView(spectogramSciChart);
xAxis = new NumericAxis(context);
xAxis.setAutoRange(AutoRange.Always);
xAxis.setDrawMinorTicks(false);
xAxis.setDrawMajorBands(false);
xAxis.setDrawMinorGridLines(false);
xAxis.setAxisAlignment(AxisAlignment.Left);
xAxis.setFlipCoordinates(true);
xAxis.setAxisTitle("Frequences (KHz)");
xAxis.setAxisTitleOrientation(AxisTitleOrientation.VerticalFlipped);
spectogramSciChart.getXAxes().add(xAxis);
yAxis = new NumericAxis(context);
yAxis.setVisibleRange(new DoubleRange(startSpectrogramRange, endSpectrogramRange));
yAxis.setDrawLabels(false);
yAxis.setDrawMinorTicks(false);
yAxis.setDrawMajorBands(false);
yAxis.setDrawMinorGridLines(false);
yAxis.setAxisAlignment(AxisAlignment.Bottom);
yAxis.setFlipCoordinates(true);
yAxis.setAxisTitleOrientation(AxisTitleOrientation.Horizontal);
spectogramSciChart.getYAxes().add(yAxis);
FastUniformHeatmapRenderableSeries f = new FastUniformHeatmapRenderableSeries();
scichartTools.getSpectrogramDS().setStartX(0f);
scichartTools.getSpectrogramDS().setStepX(0.9f);
f.setDataSeries(scichartTools.getSpectrogramDS());
f.setMaximum(100);
f.setMinimum(-30.0);
f.setColorMap(new ColorMap(
new int[]{ColorUtil.Transparent, ColorUtil.DarkBlue, ColorUtil.Purple, ColorUtil.Red, ColorUtil.Yellow, ColorUtil.White},
new float[]{0f, 0.0001f, 0.25f, 0.50f, 0.75f, 1f}
));
spectogramSciChart.getRenderableSeries().add(f);
scichartTools.getSpectrogramValues().setSize(scichartTools.getFftSize() * scichartTools.getBatchSize() * 2);
// I add the line but it's not displayed
HorizontalLineAnnotation horizontalLine = new HorizontalLineAnnotation(context);
horizontalLine.setHorizontalGravity(Gravity.FILL_HORIZONTAL);
horizontalLine.setY1(5f);
horizontalLine.setLabelValue("Label");
spectogramSciChart.getAnnotations().add(horizontalLine);
}
You can see at the bottom of the function that i added it, but it doesn’t work on this graph. Why ? Maybe the graph is drawing over my line ?
Thanks,
Best regards
Is it possible?
Or make box annotations fit screen height?
(even when zooming)
Hello,
I am currently developing an application of this type (spectrogram + audiostream) :
https://i.ibb.co/sPXMbf1/screenshot-framed-1.png
But i have one problem and one question :
Problem :
I generate the spectrum with this function :
@JvmStatic
fun generateSpectrum(shortArray: ShortArray) {
val sw = Stopwatch()
sw.start()
val buffer = ShortValues(shortArray)
val fft = Radix2FFT(buffer.size())
val fftData = DoubleValues()
fft.run(buffer, fftData)
fftData.setSize(fftSize)
val spectrogramItems = spectrogramValues.itemsArray
val fftItems = fftData.itemsArray
val spectrogramSize = spectrogramValues.size()
val fftSize = fftData.size()
val offset = spectrogramSize - fftSize
System.arraycopy(spectrogramItems, fftSize, spectrogramItems, 0, offset)
System.arraycopy(fftItems, 0, spectrogramItems, offset, fftSize)
spectrogramDS.updateZValues(spectrogramValues)
sw.stop()
Log.v(TAG, "SPECTRUM : " + sw.elapsedTime.toString())
}
It works very well to generate data from a shortarray (from microphone or saved shortarray). Except that, sometime when I launch replays, on average 1 in 10 replays will be very slow. As you can see, I put stopwatch to isolate the problems and it comes from this function. This function takes an average of 2 to 3 milliseconds in normal time to perform. When a replay is slow, this function takes on average between 6 and 8 milliseconds to execute.
Why? Do you have any ideas?
Question :
I can read data from a microphone as shown on the screenshot. I also know how to replay them by cleaning spectrogramDS and sending back the read data.
Now, let’s say I want to replay but in the form of :
What is not yet played is drawn in grey (so i don’t clean) and as the dataset plays back, it takes the same color as the recording. Basically, we see in advance the sound template that is being replayed but also where we are currently in the replay.
Is it possible ?
Thanks for you answer,
Wavely
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
When I run the LegendModifier example from tutorial, I just got an error
FATAL EXCEPTION: main
Process: br.cta.ipev.scicharttutorial, PID: 16941
java.lang.NoClassDefFoundError: com.scichart.charting.visuals.legend.SciChartLegend$LegendItemViewHolderAdapter*
ModifierGroup legendModifier = sciChartBuilder.newModifierGroup()
.withLegendModifier().withOrientation(Orientation.HORIZONTAL).withPosition(Gravity.TOP | Gravity.START, 16).build()
.build();
surface.getChartModifiers().add(legendModifier);
Hello
Currently trying this:
final NumericAxis yAxis = sciChartBuilder.newNumericAxis()
.withAutoRangeMode(AutoRange.Never)
.withTextFormatting("#.0000")
.withVisibleRangeLimit(1.143, 1.146)
.build();
Works perfectly with values .withVisibleRangeLimit(1.14, 1.15), but every time i go for more precision – range is default 0-10
Please help
Edit:
Also works fine with
.withVisibleRangeLimit(1.1433, 1.1566)
Question 2.
Is there a way to determine that live chart was scrolled by finger or by animation (when adding new point)?
I would like to format several lines differently while still scaling them all to the same YAxis. For example if one line needs to go out to 4 decimal places but then another does not need any decimal values at all i would like those formats to be represented in all of the tooltips with said formats.
Hi,
I have 3 separate line series and 1 column bar series. Whenever I switch between activities, Column bar data and range persist but not for the line series.
Whenever I return back from activityB to ActivityA it never calls restoreInstanceState. How can I persist the states of these graph?
Snap short attached for reference.
—–code,
initChartUI() {
SciChartBuilder.init(mContext)
sciChartBuilder = SciChartBuilder.instance()
xyIapDataSeries =
sciChartBuilder.newXyDataSeries(Date::class.javaObjectType, Short::class.javaObjectType)
.withSeriesName(getString(R.string.label_iap)).build()
xyTempDataSeries =
sciChartBuilder.newXyDataSeries(Date::class.javaObjectType, Short::class.javaObjectType)
.withSeriesName(getString(R.string.label_temperature)).build()
xyUoDataSeries =
sciChartBuilder.newXyDataSeries(Date::class.javaObjectType, Short::class.javaObjectType)
.withSeriesName(getString(R.string.label_uo)).build()
xyRrDataSeries =
sciChartBuilder.newXyDataSeries(Date::class.javaObjectType, Short::class.javaObjectType)
.withSeriesName(getString(R.string.label_respiratory_rate)).build()
initChartIap(iap_chart)
initChartUo(uo_chart)
initChartTemp(temperature_chart)
initChartRR(resp_rate_chart)
}
private fun initChartIap(surface: SciChartSurface) {
val xAxis = sciChartBuilder.newCategoryDateAxis()
.withBarTimeFrame(SECONDS_IN_FIVE_MINUTES.toDouble())
.withDrawMinorGridLines(false)
.withGrowBy(0.0, 0.5)
.build()
val yAxis = sciChartBuilder.newNumericAxis().withAutoRangeMode(AutoRange.Always).build()
val line = sciChartBuilder.newLineSeries().withStrokeStyle(R.color.accuryn_blue, STROKE_THICKNESS)
.withDataSeries(xyIapDataSeries).build()
// Create a Stroke Pen and assign it
val strokePen = SolidPenStyle(resources.getColor(R.color.accuryn_blue, null), true, 2f, null)
line.strokeStyle = strokePen
UpdateSuspender.using(surface) {
Collections.addAll(surface.xAxes, xAxis)
Collections.addAll(surface.yAxes, yAxis)
Collections.addAll<BaseRenderableSeries>(surface.renderableSeries, line)
Collections.addAll<AxisMarkerAnnotation>(surface.annotations, iapAxisMarker)
Collections.addAll(
surface.chartModifiers, sciChartBuilder.newModifierGroup()
.withXAxisDragModifier().build()
.withZoomPanModifier().withReceiveHandledEvents(true).withXyDirection(Direction2D.XDirection).build()
.withPinchZoomModifier().build()
.build()
)
}
……
rest 3 other types….
…..
override fun onSaveInstanceState(outState: Bundle) {
outState.run {
putInt("count", xyIapDataSeries.count)
putInt("uoCount", xyUoDataSeries.count)
putInt("tempCount", xyTempDataSeries.count)
putInt("rrCount", xyRrDataSeries.count)
val iapRange = iap_chart.xAxes[0].visibleRange
val uoRange = uo_chart.xAxes[0].visibleRange
val tempRange = temperature_chart.xAxes[0].visibleRange
val rrRange = resp_rate_chart.xAxes[0].visibleRange
putDouble("rangeIapMin", iapRange.getMinAsDouble())
putDouble("rangeIapMax", iapRange.getMaxAsDouble())
putDouble("rangeUoMin", uoRange.getMinAsDouble())
putDouble("rangeUoMax", uoRange.getMaxAsDouble())
putDouble("rangeTempMin", tempRange.getMinAsDouble())
putDouble("rangeTempMax", tempRange.getMaxAsDouble())
putDouble("rangeRrMin", rrRange.getMinAsDouble())
putDouble("rangeRrMax", rrRange.getMaxAsDouble())
}
super.onSaveInstanceState(outState)
}
override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)
updateIapData(savedInstanceState)
updateUoData(savedInstanceState)
updateTempData(savedInstanceState)
updateRRData(savedInstanceState)
}
override fun onRestoreInstanceState(savedInstanceState: Bundle?) {
super.onRestoreInstanceState(savedInstanceState)
updateIapData(savedInstanceState)
updateUoData(savedInstanceState)
updateTempData(savedInstanceState)
updateRRData(savedInstanceState)
}
private fun updateIapData(savedInstanceState: Bundle?) {
UpdateSuspender.using(iap_chart) {
var count = DEFAULT_POINT_COUNT
if (savedInstanceState != null) {
count = savedInstanceState.getInt(“count”)
val rangeMin = savedInstanceState.getDouble("rangeIapMin")
val rangeMax = savedInstanceState.getDouble("rangeIapMax")
iap_chart.xAxes[0].visibleRange.setMinMaxDouble(rangeMin, rangeMax)
}
val iap = mutableListOf<Short>()
val date = mutableListOf<Date>()
for (entry in mSimplifiedDataList) {
if (entry.emr.iap > 0) {
iap.add(entry.emr.iap)
date.add(Date(DateTimeUtils.toEpochMilli(entry.getRtcTimeStamp())))
} else {
iap.add(0)
date.add(Date(DateTimeUtils.toEpochMilli(entry.getRtcTimeStamp())))
}
}
tv_iap_input_data.text = iap[iap.size.minus(1)].toString()
xyIapDataSeries.append(date, iap)
}
}
……rest other for updating data over UI.
hi everyone
when i use utf8 string such as ‘محور’ = axis in persian sciChart lookLike this .
i tried different fonts but did not work .
SciChartBuilder.init(this@Main2Activity)
// Obtain the SciChartBuilder instance
val sciChartBuilder = SciChartBuilder.instance()
val myCustomFont: Typeface? = ResourcesCompat.getFont(this, R.font.maryam)
val fontStyle = FontStyle(myCustomFont, 50f, Color.RED)
val s = String("محور".toByteArray(Charsets.UTF_8))
xAxis = sciChartBuilder.newNumericAxis().withAxisTitleStyle(fontStyle).withAxisTitle(s).withGrowBy(DoubleRange(0.1, 0.1)).build()
yAxis = sciChartBuilder.newNumericAxis().withAxisTitle("this is y").withGrowBy(DoubleRange(0.1, 0.1)).build()
val dataSeries = XyDataSeries(Double::class.javaObjectType, Double::class.javaObjectType)
dataSeries.append(arrayOf(0.0, 2.0, 4.0, 6.0, 8.0, 10.0), arrayOf(1.0, 5.0, -5.0, -10.0, 10.0, 3.0))
rs = sciChartBuilder.newColumnSeries()
.withDataSeries(dataSeries)
.withStrokeStyle(ColorUtil.White, 3f, false)
.build()
surface.chartModifiers.add(sciChartBuilder.newModifierGroupWithDefaultModifiers().build())
UpdateSuspender.using(surface) {
Collections.addAll<IAxis>(surface.xAxes, xAxis)
Collections.addAll<IAxis>(surface.yAxes, yAxis)
Collections.addAll<FastColumnRenderableSeries>(surface.renderableSeries, rs)
}
and the result :
We’d like to customize the look of our legends. We have 4 legends displaying different data, but right now the only thing we can change is the Theme. Is there any way to customize the legend items, like add some icons, change the point marker shape and size, change the check box icon etc…
P.S.: I’m not a trial user. We have an iOS, Android and WPF licenses purchased.
Project info:
Xamarin.Android
SciChart.Android 2.2.2.854
Version
2.2.2.854