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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

Answered
0
0

Hello,

Please verify my code and help me out where I am going wrong to display multiple symbols on a price chart of multipane stock charts…
The symbols are not getting displayed

private class PricePaneModel extends BasePaneModel {

    public PricePaneModel(SciChartBuilder builder, PriceSeries prices) {
        super(builder, PRICES, "$0.0000", true);

        // Add the main OHLC chart
        final OhlcDataSeries<Date, Double> stockPrices = builder.newOhlcDataSeries(Date.class, Double.class).withSeriesName("EUR/USD").build();            
        stockPrices.append(prices.getDateData(), prices.getOpenData(), prices.getHighData(), prices.getLowData(), prices.getCloseData());
        addRenderableSeries(builder.newCandlestickSeries().withDataSeries(stockPrices).withYAxisId(PRICES).build());

        List<Double> maLowPoints = MovingAverage.movingAverage(prices.getCloseData(), 50);
        List<Double> maHighPoints = MovingAverage.movingAverage(prices.getCloseData(), 200);

        final XyDataSeries<Date, Double> maLow = builder.newXyDataSeries(Date.class, Double.class).withSeriesName("Low Line").build();
        maLow.append(prices.getDateData(), maLowPoints);
        addRenderableSeries(builder.newLineSeries().withDataSeries(maLow).withStrokeStyle(0xFFFF3333, 1f).withYAxisId(PRICES).build());

        final XyDataSeries<Date, Double> maHigh = builder.newXyDataSeries(Date.class, Double.class).withSeriesName("High Line").build();
        maHigh.append(prices.getDateData(), maHighPoints);
        addRenderableSeries(builder.newLineSeries().withDataSeries(maHigh).withStrokeStyle(0xFF33DD33, 1f).withYAxisId(PRICES).build());

        AnnotationCollection annotations = priceChart.getAnnotations();
        for (int i = 0; i < prices.size(); i++) {                
            if(maLowPoints.get(i) > maHighPoints.get(i) && maLowPoints.get(i-1) < maHighPoints.get(i-1)) {
                IAnnotation annotation = builder.newCustomAnnotation().withPosition(i, prices.getHighData().get(i)).withVerticalAnchorPoint(VerticalAnchorPoint.Bottom).build();
                annotations.add(annotation);                    
            }
            else if(maLowPoints.get(i) < maHighPoints.get(i) && maLowPoints.get(i-1) > maHighPoints.get(i-1))
            {
                IAnnotation annotation = builder.newCustomAnnotation().withPosition(i, prices.getHighData().get(i)).withVerticalAnchorPoint(VerticalAnchorPoint.Bottom).build();
                annotations.add(annotation);
            }
        }

        Collections.addAll(annotations,                   
                builder.newAxisMarkerAnnotation().withY1(stockPrices.getYValues().get(stockPrices.getCount() - 1)).withBackgroundColor(0xFFFF3333).withYAxisId(PRICES).build(),
                builder.newAxisMarkerAnnotation().withY1(maLow.getYValues().get(maLow.getCount() - 1)).withBackgroundColor(0xFFFF3333).withYAxisId(PRICES).build(),
                builder.newAxisMarkerAnnotation().withY1(maHigh.getYValues().get(maHigh.getCount() - 1)).withBackgroundColor(0xFF33DD33).withYAxisId(PRICES).build());           
    }
}
Version
2.3
Images
  • You must to post comments
Best Answer
1
0

Hi Ghousia,

Your custom annotations are not displayed because:

  • you don’t provide any content for them in your code so each annotation doesn’t have content to display;
  • your annotations don’t have correct YAxis id. If you take a look on code of BasePaneModel class In Multipane Stock Chart example you should notice that we set custom axis id for yAxis which is equal to “Prices” and annotations should bind to correct axis by specifying its axis id. In your case your annotations use default axis id for yAxis and there is no such axis with such id in YAxes collection of the chart.

To fix your code you just need to provide some content for annotation by calling withContent() method and yAxis id by calling withYAxisId() method:

                    IAnnotation annotation = builder.newCustomAnnotation().withContent(R.layout.example_custom_annotation_view).withYAxisId(PRICES).withPosition(i, prices.getHighData().get(i)).withVerticalAnchorPoint(VerticalAnchorPoint.Bottom).build();

Hope this will help you!

Best regards,
Yura

    • Guest
    • 1 year ago
    rolex baselrolex uusia 2013rolex basel päivä, jona US Dollar Euro GB Pound Canadian Dollar Australian Dollar Jappen Yen Norske Krone Swedish Krone Danish Krone CNY Ryhmät Rolex Yacht-Master II Rolex Datejust 36 rolex datejust Rolex Datejust II Rolex Datejust Lady 31 Rolex Datejust Special Edition Rolex Day-Date Rolex Day-Date II Rolex GMT-Master II Rolex Lady-Datejust Rolex Lady-Datejust Rolex Milgauss rolex oyster perpetual Rolex Rolex Deepsea Rolex SKY asukkaana Rolex Submariner rolex tutkimusmatkailija rolex tutkimusmatkailija ii Rolex Uusi 2013 mallit Rolex Yacht-Master cosmograph rolex daytona Myydyimmät Replica Sveitsin Rolex Day-Date Watch: 18 kt valkoista kultaa – €10,204.89  €176.70Säästä: 98% kopio sveitsin rolex päivä treffit kello 18: ct – keltaoranssi – €9,961.23  €187.86Säästä: 98% kopio sveitsin rolex päivä treffit kello 18: everose – m118235f €9,464.61  €210.18Säästä: 98% Esittelyssä – … Replica Sveitsin Rolex GMT-Master II -näkymä – Rolex Timeless L€26,719.83  €209.25Säästä: 99% Replica Swiss Rolex Datejust Lady 31 Watch: Keltainen Rolesor -€7,724.58  €180.42Säästä: 98% kopio sveitsin rolex datejust katsoa: everose rolesor – yhdiste€10,708.02  €188.79Säästä: 98% Home ::  Rolex Day-Date Rolex Day-Date Listattuna 1 – 12 (20 tuotteesta)  1  2   >>  kopio sveitsin rolex päivä treffit kello 18: ct – keltaoranssi €11,547.81  €189.72Säästä: 98% kopio sveitsin rolex päivä treffit kello 18: ct – keltaoranssi €7,852.92  €216.69Säästä: 97% kopio sveitsin rolex päivä treffit kello 18: everose – m118235f€8,260.26  €200.88Säästä: 98% kopio sveitsin rolex päivä treffit kello 18: everose – m118235f€9,464.61  €210.18Säästä: 98% kopio sveitsin rolex päivä treffit kello 18: everose – m118235f€11,623.14  €198.09Säästä: 98% kopio sveitsin rolex päivä treffit kello 18: – m118239-0121 val€11,784.96  €183.21Säästä: 98% Replica Sveitsin Rolex Day-Date Watch: 18 kt keltaista kultaa -€7,302.36  €201.81Säästä: 97% Replica Sveitsin Rolex Day-Date Watch: 18 kt valkoista kultaa -€9,358.59  €210.18Säästä: 98% kopio sveitsin rolex päivä treffit – – rolex ajaton ylellisyyttä€12,531.75  €197.16Säästä: 98% kopio sveitsin rolex päivä treffit kello 18: ct – keltaoranssi –€9,260.01  €179.49Säästä: 98% kopio sveitsin rolex päivä treffit kello 18: ct – keltaoranssi –€9,961.23  €187.86Säästä: 98% kopio sveitsin rolex päivä treffit kello 18: ct – keltaoranssi –€11,173.95  €211.11Säästä: 98% Listattuna 1 – 12 (20 tuotteesta)  1  2   >>  Koti   laivaus   Tukkukauppa   Tilauksen seuranta   kuponkeja   maksutavat   Ota meihin yhteyttä   Uudet Replica kellot   Replica Rolex kellot   AAAA Replica Rolex kellot   Fake Rolex kellot   Replica Rolex Oyster   Halvat Replica Rolex kellot   Copyright © 2012 Kaikki oikeudet pidätetään. Rolex Datejust Rolex Submariner replica blog About submarinerrolex.top blog
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.