@Override protected void onCreate(Bundle savedInstanceState) { fpsDrawable = new FpsDrawable(this); SciChartBuilder.init(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_example); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } setUpExample(savedInstanceState); setUpDrawerAndToolbar(); }
@Override public void run() { Collections.addAll(surface.getXAxes(), xAxis); Collections.addAll(surface.getYAxes(), yAxis); Collections.addAll(surface.getRenderableSeries(), lineRs1, lineRs2); Collections.addAll(surface.getChartModifiers(), sciChartBuilder.newModifierGroup().withRolloverModifier().build().build()); sciChartBuilder.newAnimator(lineRs1).withSweepTransformation().withInterpolator(new DecelerateInterpolator()).withDuration(3000).withStartDelay(350).start(); sciChartBuilder.newAnimator(lineRs2).withSweepTransformation().withInterpolator(new DecelerateInterpolator()).withDuration(3000).withStartDelay(350).start(); } });
@Override protected void initExample() { final IAxis xAxis = sciChartBuilder.newNumericAxis().withGrowBy(0.1d, 0.1d).withVisibleRange(1.1, 2.7).build(); final IAxis yAxis = sciChartBuilder.newNumericAxis().withGrowBy(0.1d, 0.1d).build(); final DoubleSeries fourierSeries = DataManager.getInstance().getFourierSeries(1.0, 0.1, 5000); final IXyDataSeries<Double, Double> dataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).build(); dataSeries.append(fourierSeries.xValues, fourierSeries.yValues); final FastLineRenderableSeries rSeries = sciChartBuilder.newLineSeries().withDataSeries(dataSeries).withStrokeStyle(0xFF279B27, 1f, true).build(); UpdateSuspender.using(surface, new Runnable() { @Override public void run() { Collections.addAll(surface.getXAxes(), xAxis); Collections.addAll(surface.getYAxes(), yAxis); Collections.addAll(surface.getRenderableSeries(), rSeries); Collections.addAll(surface.getChartModifiers(), sciChartBuilder.newModifierGroupWithDefaultModifiers().build()); sciChartBuilder.newAnimator(rSeries).withSweepTransformation().withInterpolator(new DecelerateInterpolator()).withDuration(3000).withStartDelay(350).start(); } }); } }
private IRenderableSeries initFixedErrorBarsSeries(FastFixedErrorBarsRenderableSeries series) { final XyDataSeries<Double, Double> dataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).build(); double[] randomWalk = getRandomWalk(0d); for (int i = 0; i < POINTS_COUNT; i++) { dataSeries.append((double) i, randomWalk[i]); } series.setDataSeries(dataSeries); initAnimators(sciChartBuilder.newAnimator(series)); sweepAnimator = sciChartBuilder.newAnimator(series).withSweepTransformation().build(); return series; }
@Override protected void initExample() { seekBar.setOnSeekBarChangeListener(this); final NumericAxis xAxis = sciChartBuilder.newNumericAxis().withAxisAlignment(AxisAlignment.Bottom).build(); final NumericAxis yAxis = sciChartBuilder.newNumericAxis().withAxisAlignment(AxisAlignment.Right).build(); final UniformHeatmapDataSeries<Integer, Integer, Double> dataSeries = new UniformHeatmapDataSeries<>(Integer.class, Integer.class, Double.class, WIDTH, HEIGHT); paletteProvider.setThresholdValue(seekBar.getProgress()); dataSeries.updateZValues(createValues()); final FastUniformHeatmapRenderableSeries heatmapRenderableSeries = sciChartBuilder.newUniformHeatmap() .withDataSeries(dataSeries) .withMinimum(0) .withMaximum(200) .withPaletteProvider(paletteProvider) .build(); Collections.addAll(chart.getXAxes(), xAxis); Collections.addAll(chart.getYAxes(), yAxis); Collections.addAll(chart.getRenderableSeries(), heatmapRenderableSeries); Collections.addAll(chart.getChartModifiers(), sciChartBuilder.newModifierGroupWithDefaultModifiers().build()); }
SciChartBuilder.init(this); final SciChartBuilder sciChartBuilder = SciChartBuilder.instance(); final IAxis xAxis = sciChartBuilder.newNumericAxis() .withAxisTitle("X Axis Title") .withVisibleRange(-5, 15) final IAxis yAxis = sciChartBuilder.newNumericAxis() .withAxisTitle("Y Axis Title").withVisibleRange(0, 100).build(); TextAnnotation textAnnotation = sciChartBuilder.newTextAnnotation() .withX1(5.0) .withY1(55.0) ModifierGroup chartModifiers = sciChartBuilder.newModifierGroup() .withPinchZoomModifier().withReceiveHandledEvents(true).build() .withZoomPanModifier().withReceiveHandledEvents(true).build() XyDataSeries lineData = sciChartBuilder.newXyDataSeries(Integer.class, Double.class).build(); XyDataSeries scatterData = sciChartBuilder.newXyDataSeries(Integer.class, Double.class).build(); final IRenderableSeries lineSeries = sciChartBuilder.newLineSeries() .withDataSeries(lineData) .withStrokeStyle(ColorUtil.LightBlue, 2f, true) .newPointMarker(new EllipsePointMarker()) .withFill(ColorUtil.LightBlue) .withStroke(ColorUtil.Green, 2f)
@Override protected void initExample() { final IAxis xAxis = sciChartBuilder.newNumericAxis().build(); final IAxis yAxis = sciChartBuilder.newNumericAxis().withGrowBy(new DoubleRange(0.2d, 0.2d)).build(); final XyDataSeries<Integer, Double> ds1 = sciChartBuilder.newXyDataSeries(Integer.class, Double.class).withSeriesName("Sinewave A").build(); final XyDataSeries<Integer, Double> ds2 = sciChartBuilder.newXyDataSeries(Integer.class, Double.class).withSeriesName("Sinewave B").build(); final XyDataSeries<Integer, Double> ds3 = sciChartBuilder.newXyDataSeries(Integer.class, Double.class).withSeriesName("Sinewave C").build(); final FastLineRenderableSeries rs1 = sciChartBuilder.newLineSeries() .withDataSeries(ds1) .withStrokeStyle(ColorUtil.SteelBlue, 2) .withPointMarker(sciChartBuilder.newPointMarker(new EllipsePointMarker()) .withSize(7, 7) .withFill(ColorUtil.Lavender) .build()) .build(); final FastLineRenderableSeries rs2 = sciChartBuilder.newLineSeries() .withDataSeries(ds2) .withStrokeStyle(ColorUtil.DarkGreen, 2) .withPointMarker(sciChartBuilder.newPointMarker(new EllipsePointMarker()) .withSize(7, 7) .withFill(ColorUtil.Lavender) .build()) .build(); final FastLineRenderableSeries rs3 = sciChartBuilder.newLineSeries() .withDataSeries(ds3) .withStrokeStyle(ColorUtil.LightSteelBlue, 2, true)
@Override protected void initExample() { final IAxis xAxis = sciChartBuilder.newNumericAxis().withVisibleRange(150d, 165d).build(); final IAxis yAxis = sciChartBuilder.newNumericAxis().withLabelProvider(new ThousandsLabelProvider()).withGrowBy(0, 0.1).withAutoRangeMode(AutoRange.Always).build(); final IXyDataSeries<Double, Double> mountainDataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).withSeriesName("Mountain Series").build(); final IXyDataSeries<Double, Double> lineDataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).withSeriesName("Line Series").build(); final IXyDataSeries<Double, Double> columnDataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).withSeriesName("Column Series").build(); final IXyDataSeries<Double, Double> xyScatterDataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).withSeriesName("Scatter Series").build(); final IOhlcDataSeries<Double, Double> candlestickDataSeries = sciChartBuilder.newOhlcDataSeries(Double.class, Double.class).withSeriesName("Candlestick Series").build(); final IOhlcDataSeries<Double, Double> ohlcDataSeries = sciChartBuilder.newOhlcDataSeries(Double.class, Double.class).withSeriesName("OHLC Series").build(); final BoxAnnotation annotation = sciChartBuilder.newBoxAnnotation().withPosition(152d, 0, 158d, 1).withBackgroundDrawableId(R.drawable.example_box_annotation_background_1).withIsEditable(true).withCoordinateMode(AnnotationCoordinateMode.RelativeY).build(); annotation.setOnAnnotationDragListener(new OnAnnotationDragListener() { @Override final FastMountainRenderableSeries mountainSeries = sciChartBuilder.newMountainSeries() .withAreaFillColor(0x9787CEEB) .withStrokeStyle(ColorUtil.Magenta) final FastLineRenderableSeries lineSeries = sciChartBuilder.newLineSeries() .withStrokeStyle(ColorUtil.Blue) .withPointMarker(sciChartBuilder.newPointMarker(new EllipsePointMarker()).withFill(ColorUtil.Red).withStroke(ColorUtil.Orange, 2f).withSize(10, 10).build()) .withDataSeries(lineDataSeries) .withPaletteProvider(new XyCustomPaletteProvider(ColorUtil.Red, annotation)) .build(); final FastOhlcRenderableSeries ohlcSeries = sciChartBuilder.newOhlcSeries() .withDataSeries(ohlcDataSeries) .withPaletteProvider(new OhlcCustomPaletteProvider(ColorUtil.CornflowerBlue, annotation))
SciChartBuilder.init(this); final SciChartBuilder sciChartBuilder = SciChartBuilder.instance(); final IAxis xAxis = sciChartBuilder.newNumericAxis() .withAxisTitle("X Axis Title") .withVisibleRange(-5, 15) final IAxis yAxis = sciChartBuilder.newNumericAxis() .withAxisTitle("Y Axis Title").withVisibleRange(0, 100).build(); TextAnnotation textAnnotation = sciChartBuilder.newTextAnnotation() .withX1(5.0) .withY1(55.0) ModifierGroup chartModifiers = sciChartBuilder.newModifierGroup() .withPinchZoomModifier().withReceiveHandledEvents(true).build() .withZoomPanModifier().withReceiveHandledEvents(true).build()
final IAxis xBottomAxis = sciChartBuilder.newNumericAxis().withGrowBy(0.1d, 0.1d).withVisibleRange(150, 180).build(); final IAxis yRightAxis = sciChartBuilder.newNumericAxis() .withGrowBy(0.1d, 0.1d) .withAxisAlignment(AxisAlignment.Right) .build(); final IAxis yLeftAxis = sciChartBuilder.newNumericAxis() .withGrowBy(0, 3d) .withAxisAlignment(AxisAlignment.Left) final PriceSeries priceBars = dataManager.getPriceDataIndu(getActivity()); final IXyDataSeries<Double, Double> mountainDataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).withSeriesName("Mountain Series").build(); final IXyDataSeries<Double, Double> lineDataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).withSeriesName("Line Series").build(); final IXyDataSeries<Double, Long> columnDataSeries = sciChartBuilder.newXyDataSeries(Double.class, Long.class).withSeriesName("Column Series").build(); final IOhlcDataSeries<Double, Double> candlestickDataSeries = sciChartBuilder.newOhlcDataSeries(Double.class, Double.class).withSeriesName("Candlestick Series").build(); final FastMountainRenderableSeries mountainSeries = sciChartBuilder.newMountainSeries().withDataSeries(mountainDataSeries).withYAxisId("PrimaryAxisId").build(); final FastLineRenderableSeries lineSeries = sciChartBuilder.newLineSeries().withDataSeries(lineDataSeries).withYAxisId("PrimaryAxisId").build(); final FastColumnRenderableSeries columnSeries = sciChartBuilder.newColumnSeries().withDataSeries(columnDataSeries).withYAxisId("SecondaryAxisId").build(); final FastCandlestickRenderableSeries candlestickSeries = sciChartBuilder.newCandlestickSeries().withDataSeries(candlestickDataSeries).withYAxisId("PrimaryAxisId").build(); final ModifierGroup modifiers = sciChartBuilder.newModifierGroup() .withLegendModifier().withShowCheckBoxes(false).build() .withModifier(cursorModifier)
@Override protected void initExample() { IXyDataSeries<Double, Double> dataSeries0 = sciChartBuilder.newXyDataSeries(Double.class, Double.class).withSeriesName("Line Series").build(); dataSeries0.append(new Double[]{0d, 1d, 2d, 3d, 4d, 5d, 6d, 7d, 8d, 9d}, new Double[]{0d, 0.1d, 0.3d, 0.5d, 0.4d, 0.35d, 0.3d, 0.25d, 0.2d, 0.1d, 0.05d}); IXyDataSeries<Double, Double> dataSeries1 = sciChartBuilder.newXyDataSeries(Double.class, Double.class).withSeriesName("Mountain Series").build(); dataSeries1.append(dataSeries0.getXValues(), ListUtil.select(dataSeries0.getYValues(), new Func1<Double, Double>() { @Override IXyDataSeries<Double, Double> dataSeries2 = sciChartBuilder.newXyDataSeries(Double.class, Double.class).withSeriesName("Column Series").build(); dataSeries2.append(dataSeries0.getXValues(), ListUtil.select(dataSeries0.getYValues(), new Func1<Double, Double>() { @Override final IAxis xAxis = sciChartBuilder.newNumericAxis().withAxisAlignment(AxisAlignment.Bottom).build(); final IAxis yAxis = sciChartBuilder.newNumericAxis().withAxisAlignment(AxisAlignment.Left).withGrowBy(new DoubleRange(0d, 0.1d)).build(); final FastLineRenderableSeries lineSeries = sciChartBuilder.newLineSeries() .withDataSeries(dataSeries0) .withStrokeStyle(ColorUtil.SteelBlue, 3) .withPointMarker(sciChartBuilder.newPointMarker(new EllipsePointMarker()) .withSize(30, 30) .withFill(ColorUtil.SteelBlue) final FastMountainRenderableSeries mountainSeries = sciChartBuilder.newMountainSeries() .withStrokeStyle(ColorUtil.SteelBlue, 2f) .withAreaFillColor(ColorUtil.LightSteelBlue) final FastColumnRenderableSeries columnSeries = sciChartBuilder.newColumnSeries() .withDataSeries(dataSeries2) .build();
@Override public void run() { final IAxis xBottomAxis = sciChartBuilder.newNumericAxis() .withVisibleRange(new DoubleRange(0d, 10d)) .withAutoRangeMode(AutoRange.Never) .withAxisTitle("Time (seconds)") .build(); final IAxis yRightAxis = sciChartBuilder.newNumericAxis() .withVisibleRange(new DoubleRange(-0.5d, 1.5d)) .withAxisTitle("Voltage (mV)") .build(); final IRenderableSeries rs1 = sciChartBuilder.newLineSeries() .withDataSeries(series0) .build(); final IRenderableSeries rs2 = sciChartBuilder.newLineSeries() .withDataSeries(series1) .build(); Collections.addAll(surface.getXAxes(), xBottomAxis); Collections.addAll(surface.getYAxes(), yRightAxis); Collections.addAll(surface.getRenderableSeries(), rs1, rs2); } });
@Override protected void initExample() { final IAxis xAxis = sciChartBuilder.newDateAxis().withGrowBy(0.1, 0.1).build(); final IAxis yAxis = sciChartBuilder.newNumericAxis().withGrowBy(0.1, 0.1).build(); final XyDataSeries<Date, Double> actualDataSeries = sciChartBuilder.newXyDataSeries(Date.class, Double.class).build(); final XyyDataSeries<Date, Double> var3DataSeries = sciChartBuilder.newXyyDataSeries(Date.class, Double.class).build(); final XyyDataSeries<Date, Double> var2DataSeries = sciChartBuilder.newXyyDataSeries(Date.class, Double.class).build(); final XyyDataSeries<Date, Double> var1DataSeries = sciChartBuilder.newXyyDataSeries(Date.class, Double.class).build(); final FastBandRenderableSeries projectedVar3 = sciChartBuilder.newBandSeries().withDataSeries(var3DataSeries).withStrokeY1Style(ColorUtil.Transparent).withStrokeStyle(ColorUtil.Transparent).build(); final FastBandRenderableSeries projectedVar2 = sciChartBuilder.newBandSeries().withDataSeries(var2DataSeries).withStrokeY1Style(ColorUtil.Transparent).withStrokeStyle(ColorUtil.Transparent).build(); final FastBandRenderableSeries projectedVar = sciChartBuilder.newBandSeries().withDataSeries(var1DataSeries).withStrokeY1Style(ColorUtil.Transparent).withStrokeStyle(ColorUtil.Transparent).build(); final FastLineRenderableSeries lineSeries = sciChartBuilder.newLineSeries().withDataSeries(actualDataSeries).withStrokeStyle(ColorUtil.Red, 1f).build();
final IPointMarker pointMarker1 = sciChartBuilder.newPointMarker(new EllipsePointMarker()).withSize(50).withFill(0x990077ff).withStroke(ColorUtil.Blue, 2).build(); final IPointMarker pointMarker2 = sciChartBuilder.newPointMarker(new EllipsePointMarker()).withSize(60).withFill(0x99ff0000).withStroke(ColorUtil.Red, 2).build(); final IPointMarker pointMarker3 = sciChartBuilder.newPointMarker(new EllipsePointMarker()).withSize(60).withFill(new RadialGradientBrushStyle(0.5f, 0.5f, 0.4f, 0.4f, ColorUtil.Red, ColorUtil.Green)).withStroke(0xffff6600, 2).build(); final IPointMarker pointMarker4 = sciChartBuilder.newPointMarker(new EllipsePointMarker()).withSize(65).withStroke(ColorUtil.Magenta, 4).build(); final IPointMarker pointMarker5 = sciChartBuilder.newPointMarker(new EllipsePointMarker()).withSize(75).withFill(new TextureBrushStyle(texture)).withStroke(sciChartBuilder.newPen().withColor(ColorUtil.Red).withThickness(4f).withStrokeDashArray(new float[]{2, 3, 4, 5}).build()).build(); IRenderableSeries rs1 = sciChartBuilder.newLineSeries().withDataSeries(ds1).withPointMarker(pointMarker1).withStrokeStyle(ColorUtil.Blue).build(); IRenderableSeries rs2 = sciChartBuilder.newLineSeries().withDataSeries(ds2).withPointMarker(pointMarker2).withStrokeStyle(ColorUtil.Red).build(); IRenderableSeries rs3 = sciChartBuilder.newLineSeries().withDataSeries(ds3).withPointMarker(pointMarker3).withStrokeStyle(ColorUtil.Yellow).build(); IRenderableSeries rs4 = sciChartBuilder.newLineSeries().withDataSeries(ds4).withPointMarker(pointMarker4).withStrokeStyle(ColorUtil.Magenta).build(); IRenderableSeries rs5 = sciChartBuilder.newLineSeries().withDataSeries(ds5).withPointMarker(pointMarker5).withStrokeStyle(ColorUtil.Olive).build(); Collections.addAll(surface.getXAxes(), sciChartBuilder.newNumericAxis().withGrowBy(new DoubleRange(0.1, 0.1)).build()); Collections.addAll(surface.getYAxes(), sciChartBuilder.newNumericAxis().withGrowBy(new DoubleRange(0.1, 0.1)).build()); Collections.addAll(surface.getRenderableSeries(), rs1, rs2, rs3, rs4, rs5); Collections.addAll(surface.getChartModifiers(), sciChartBuilder.newModifierGroupWithDefaultModifiers().build());
ds5.updateYAt(7, Double.NaN); final IPointMarker pointMarker1 = sciChartBuilder.newPointMarker(new EllipsePointMarker()).withSize(15,15).withFill(0x990077ff).withStroke(ColorUtil.LightBlue, 2).build(); final IPointMarker pointMarker2 = sciChartBuilder.newPointMarker(new SquarePointMarker()).withSize(20, 20).withFill(0x99ff0000).withStroke(ColorUtil.Red, 2).build(); final IPointMarker pointMarker3 = sciChartBuilder.newPointMarker(new TrianglePointMarker()).withSize(20, 20).withFill(0xffffdd00).withStroke(0xffff6600, 2).build(); final IPointMarker pointMarker4 = sciChartBuilder.newPointMarker(new CrossPointMarker()).withSize(25, 25).withStroke(ColorUtil.Magenta, 4).build(); final IPointMarker pointMarker5 = sciChartBuilder.newPointMarker(new SpritePointMarker(new CustomPointMarkerDrawer(getActivity(), R.drawable.example_weather_storm))).withSize(40, 40).build(); IRenderableSeries rs1 = sciChartBuilder.newLineSeries().withDataSeries(ds1).withPointMarker(pointMarker1).withStrokeStyle(ColorUtil.LightBlue, 2f).build(); IRenderableSeries rs2 = sciChartBuilder.newLineSeries().withDataSeries(ds2).withPointMarker(pointMarker2).withStrokeStyle(ColorUtil.Red, 2f).build(); IRenderableSeries rs3 = sciChartBuilder.newLineSeries().withDataSeries(ds3).withPointMarker(pointMarker3).withStrokeStyle(ColorUtil.Yellow, 2f).build(); IRenderableSeries rs4 = sciChartBuilder.newLineSeries().withDataSeries(ds4).withPointMarker(pointMarker4).withStrokeStyle(ColorUtil.Magenta, 2f).build(); IRenderableSeries rs5 = sciChartBuilder.newLineSeries().withDataSeries(ds5).withPointMarker(pointMarker5).withStrokeStyle(ColorUtil.Wheat, 2f).build(); Collections.addAll(surface.getXAxes(), sciChartBuilder.newNumericAxis().withGrowBy(new DoubleRange(0.1, 0.1)).build()); Collections.addAll(surface.getYAxes(), sciChartBuilder.newNumericAxis().withGrowBy(new DoubleRange(0.1, 0.1)).build()); Collections.addAll(surface.getRenderableSeries(), rs1, rs2, rs3, rs4, rs5); Collections.addAll(surface.getChartModifiers(), sciChartBuilder.newModifierGroupWithDefaultModifiers().build()); sciChartBuilder.newOpacityAnimator(rs1).withDuration(1000).withStartDelay(350).start(); sciChartBuilder.newOpacityAnimator(rs2).withDuration(1000).withStartDelay(350).start(); sciChartBuilder.newOpacityAnimator(rs3).withDuration(1000).withStartDelay(350).start(); sciChartBuilder.newOpacityAnimator(rs4).withDuration(1000).withStartDelay(350).start(); sciChartBuilder.newOpacityAnimator(rs5).withDuration(1000).withStartDelay(350).start();
@Override protected void initExample() { final IAxis xAxis = sciChartBuilder.newNumericAxis().withTextFormatting("0.0").withGrowBy(0.1, 0.1).withVisibleRange(3, 6).build(); final IAxis rightYAxis = sciChartBuilder.newNumericAxis().withAxisId("RightAxisId").withAxisAlignment(AxisAlignment.Right).withTextColor(0xFF279B27).withGrowBy(0.1, 0.1).build(); final IAxis leftYAxis = sciChartBuilder.newNumericAxis().withAxisId("LeftAxisId").withAxisAlignment(AxisAlignment.Left).withTextColor(0xFF4083B7).withGrowBy(0.1, 0.1).build(); final XyDataSeries<Double, Double> mountainDS = sciChartBuilder.newXyDataSeries(Double.class, Double.class).build(); final XyDataSeries<Double, Double> lineDS = sciChartBuilder.newXyDataSeries(Double.class, Double.class).build(); final FastMountainRenderableSeries mountainRenderableSeries = sciChartBuilder.newMountainSeries().withDataSeries(mountainDS).withAreaFillColor(0x771964FF).withStrokeStyle(0xFF0944CF, 2f, true).withYAxisId("LeftAxisId").build(); final FastLineRenderableSeries lineRenderableSeries = sciChartBuilder.newLineSeries().withDataSeries(lineDS).withStrokeStyle(0xFF279B27, 2f, true).withYAxisId("RightAxisId").build();
@Override protected void initExample() { final OhlcDataSeries<Date, Double> dataSeries = sciChartBuilder.newOhlcDataSeries(Date.class, Double.class).build(); Collections.addAll(surface.getRenderableSeries(), sciChartBuilder.newCandlestickSeries().withDataSeries(dataSeries).build()); Collections.addAll(surface.getXAxes(), sciChartBuilder.newCategoryDateAxis().build()); Collections.addAll(surface.getYAxes(), sciChartBuilder.newNumericAxis().withVisibleRange(30d, 37d).build()); Collections.addAll(surface.getChartModifiers(), new ZoomPanModifier()); sciChartBuilder.newTextAnnotation() .withIsEditable(true) .withText("Buy!") .withZIndex(1) // draw this annotation above other annotations .build(), sciChartBuilder.newTextAnnotation() .withBackgroundDrawableId(R.drawable.example_text_annotation_background) .withIsEditable(true) .withZIndex(1) // draw this annotation above other annotations .build(), sciChartBuilder.newTextAnnotation() .withX1(80d).withY1(37d) .withIsEditable(true) .withZIndex(1) // draw this annotation above other annotations .build(), sciChartBuilder.newBoxAnnotation() .withIsEditable(true) .withBackgroundDrawableId(R.drawable.example_box_annotation_background_4)
@Override protected void initExample() { final IAxis xBottomAxis = sciChartBuilder.newNumericAxis().withGrowBy(0.1d, 0.1d).build(); final IAxis yRightAxis = sciChartBuilder.newNumericAxis().withGrowBy(0.1d, 0.1d).build(); final IXyDataSeries<Double, Double> dataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).build(); dataSeries.append(ds1Points.xValues, ds1Points.yValues); final EllipsePointMarker pointMarker = sciChartBuilder.newPointMarker(new EllipsePointMarker()) .withSize(10, 10) .withStroke(ColorUtil.argb(0xFF, 0x00, 0x66, 0xFF), 1) .build(); final FastImpulseRenderableSeries rSeries = sciChartBuilder.newImpulseSeries() .withDataSeries(dataSeries) .withXAxisId(xBottomAxis.getAxisId())
@Override protected void initExample() { final IAxis xBottomAxis = sciChartBuilder.newDateAxis().withGrowBy(0.1d, 0.1d).build(); final IAxis yRightAxis = sciChartBuilder.newNumericAxis().withGrowBy(0.1d, 0.1d).build(); final PriceSeries priceData = DataManager.getInstance().getPriceDataIndu(getActivity()); final IXyDataSeries<Date, Double> dataSeries = sciChartBuilder.newXyDataSeries(Date.class, Double.class).build(); dataSeries.append(priceData.getDateData(), priceData.getCloseData()); final FastMountainRenderableSeries rSeries = sciChartBuilder.newMountainSeries() .withDataSeries(dataSeries) .withStrokeStyle(0xAAFFC9A8, 1f, true) .withAreaFillLinearGradientColors(0xAAFF8D42, 0x88090E11) .build(); UpdateSuspender.using(surface, new Runnable() { @Override public void run() { Collections.addAll(surface.getXAxes(), xBottomAxis); Collections.addAll(surface.getYAxes(), yRightAxis); Collections.addAll(surface.getRenderableSeries(), rSeries); Collections.addAll(surface.getChartModifiers(), sciChartBuilder.newModifierGroupWithDefaultModifiers().build()); sciChartBuilder.newAnimator(rSeries).withWaveTransformation().withInterpolator(new DecelerateInterpolator()).withDuration(3000).withStartDelay(350).start(); } }); } }
private XyScatterRenderableSeries getScatterRenderableSeries(IPointMarker pointMarker, @ColorInt int color, boolean negative) { final String seriesName = pointMarker instanceof EllipsePointMarker ? negative ? "Negative Ellipse" : "Positive Ellipse" : negative ? "Negative" : "Positive"; final IXyDataSeries<Integer, Double> dataSeries = sciChartBuilder.newXyDataSeries(Integer.class, Double.class).withSeriesName(seriesName).build(); for (int i = 0; i < 200; i++) { final double time = (i < 100) ? getRandom(random, 0, i + 10) / 100 : getRandom(random, 0, 200 - i + 10) / 100; final double y = negative ? -time * time * time : time * time * time; dataSeries.append(i, y); } return sciChartBuilder.newScatterSeries() .withDataSeries(dataSeries) .withStrokeStyle(color) .withPointMarker(sciChartBuilder.newPointMarker(pointMarker) .withSize(6, 6) .withStroke(0xFFFFFFFF, 0.1f) .withFill(color) .build()) .build(); }