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
- damien gaillard asked 5 years ago
- You must login to post comments
It’s not a line on the picture, i ve checked
By the way, i add other lines to confirm that it s not a line close to 0. I add vertical lines and horizontal lines.
My range of Y axis (alignment bottom) is 3500 – 4000
Here is the lines i added that are still not drawn :
// I add the line but it's not displayed
HorizontalLineAnnotation horizontalLine = new HorizontalLineAnnotation(context);
horizontalLine.setHorizontalGravity(Gravity.FILL_HORIZONTAL);
horizontalLine.setY1(3600f);
horizontalLine.setLabelValue("Label");
spectogramSciChart.getAnnotations().add(horizontalLine);
// I add the line but it's not displayed
VerticalLineAnnotation verticalLine = new VerticalLineAnnotation(context);
verticalLine.setVerticalGravity(Gravity.FILL_VERTICAL);
verticalLine.setX1(3600f);
verticalLine.setLabelValue("Label");
spectogramSciChart.getAnnotations().add(verticalLine);
// I add the line but it's not displayed
HorizontalLineAnnotation horizontalLine2 = new HorizontalLineAnnotation(context);
horizontalLine2.setHorizontalGravity(Gravity.FILL_HORIZONTAL);
horizontalLine2.setY1(5f);
horizontalLine2.setLabelValue("Label");
spectogramSciChart.getAnnotations().add(horizontalLine2);
// I add the line but it's not displayed
VerticalLineAnnotation verticalLine2 = new VerticalLineAnnotation(context);
verticalLine2.setVerticalGravity(Gravity.FILL_VERTICAL);
verticalLine2.setX1(5f);
verticalLine2.setLabelValue("Label");
spectogramSciChart.getAnnotations().add(verticalLine2);
// I add the line but it's not displayed
HorizontalLineAnnotation horizontalLine3 = new HorizontalLineAnnotation(context);
horizontalLine3.setHorizontalGravity(Gravity.FILL_HORIZONTAL);
horizontalLine3.setY1(50f);
horizontalLine3.setLabelValue("Label");
spectogramSciChart.getAnnotations().add(horizontalLine3);
// I add the line but it's not displayed
VerticalLineAnnotation verticalLine3 = new VerticalLineAnnotation(context);
verticalLine3.setVerticalGravity(Gravity.FILL_VERTICAL);
verticalLine3.setX1(50f);
verticalLine3.setLabelValue("Label");
spectogramSciChart.getAnnotations().add(verticalLine3);
Have you got an idea ?
Best regards
- damien gaillard answered 5 years ago
-
OK, I think I could reproduce this issue. I’ve created a task in our bug tracker to investigate it ( https://abtsoftware.myjetbrains.com/youtrack/issue/SC_DROID-652 )
-
Okey thank you, keep me informed, Best regards
-
Can you try to update to the latest nightly build ( v2.5.0.2496 ) – this issue should be fixed now. Also please have in mind that for vertical chart ( when xAxis is placed vertically ) you’ll need to to set X1 for HorizontalLineAnnotation and Y1 for VerticalLineAnnotation because as you see from annotation’s name it would be strange to draw HorizontallLineAnnotation as vertical line and vice versa in case of VerticalLineAnnotation when chart is rotated.
-
Ok it works with the latest nightly build ( v2.5.0.2496 ), i get my line :) Thank you
- You must login to post comments
Hi Damien,
I believe line is displayed on your screenshot – it’s just drawn vertically on the left edge of the chart. You changed axis alignment and placed YAxis at the bottom and XAxis on the left side of chart. Also I believe heatmap has alot of values in Y direction so line is drawn very close to 0 value of YAxis which is on the edge of chart. Can you check this?
Best regards,
Yura
- Yura Khariton answered 5 years ago
- last edited 5 years ago
- You must login to post comments
Please login first to submit.