@@ -6,7 +6,8 @@ import * as moment from 'moment';
66
77import { Cryptocurrency } from '../../entities/cryptocurrency' ;
88import { ChartPeriod } from '../../entities/chartperiod' ;
9- import { CoinMarketCapGraphsResponse } from '../../responses/coinmarketcapgraphsresponse' ;
9+ import { Graphs } from '../../entities/graphs' ;
10+ import { CryptoWalletResponse } from '../../responses/cryptowalletresponse' ;
1011
1112import { CoinMarketCapProvider } from '../../providers/coinmarketcap/coinmarketcap' ;
1213import { UnregisteredChartPeriodProvider } from '../../providers/unregistered/chartperiod' ;
@@ -242,9 +243,9 @@ export class ChartPage {
242243 let loadingOverlay = this . loadingCtrl . create ( { content : 'Please wait...' } ) ;
243244 loadingOverlay . present ( ) ;
244245
245- let coinMarketCapGraphsResponse : Observable < CoinMarketCapGraphsResponse > = ( period === "ALL" ? this . coinMarketCapProvider . allPrices ( this . cryptocurrency ) : this . coinMarketCapProvider . allPricesBetween ( this . cryptocurrency , startDateValue , endDateValue ) ) ;
246- coinMarketCapGraphsResponse . subscribe ( result => {
247- refreshChartCallback ( refreshChart , chart , result , this . getFormatValue ( period ) , this . getMaxTicksValue ( period ) ) ;
246+ let graphsResponse : Observable < CryptoWalletResponse < Graphs > > = ( period === "ALL" ? this . coinMarketCapProvider . allPrices ( this . cryptocurrency ) : this . coinMarketCapProvider . allPricesBetween ( this . cryptocurrency , startDateValue , endDateValue ) ) ;
247+ graphsResponse . subscribe ( result => {
248+ refreshChartCallback ( refreshChart , chart , result . data , this . getFormatValue ( period ) , this . getMaxTicksValue ( period ) ) ;
248249
249250 loadingOverlay . dismiss ( ) ;
250251 } , error => {
@@ -308,20 +309,20 @@ export class ChartPage {
308309 }
309310 }
310311
311- private refreshUsdChart ( refreshChart : Function , chart : Chart , coinMarketCapGraphsResponse : CoinMarketCapGraphsResponse , labelFormat : string , maxTicksValue : number ) : void {
312- refreshChart ( chart , coinMarketCapGraphsResponse . price_usd , labelFormat , maxTicksValue ) ;
312+ private refreshUsdChart ( refreshChart : Function , chart : Chart , graphs : Graphs , labelFormat : string , maxTicksValue : number ) : void {
313+ refreshChart ( chart , graphs . priceUsd , labelFormat , maxTicksValue ) ;
313314 }
314315
315- private refreshBtcChart ( refreshChart : Function , chart : Chart , coinMarketCapGraphsResponse : CoinMarketCapGraphsResponse , labelFormat : string , maxTicksValue : number ) : void {
316- refreshChart ( chart , coinMarketCapGraphsResponse . price_btc , labelFormat , maxTicksValue ) ;
316+ private refreshBtcChart ( refreshChart : Function , chart : Chart , graphs : Graphs , labelFormat : string , maxTicksValue : number ) : void {
317+ refreshChart ( chart , graphs . priceBtc , labelFormat , maxTicksValue ) ;
317318 }
318319
319- private refreshMarketCapChart ( refreshChart : Function , chart : Chart , coinMarketCapGraphsResponse : CoinMarketCapGraphsResponse , labelFormat : string , maxTicksValue : number ) : void {
320- refreshChart ( chart , coinMarketCapGraphsResponse . market_cap_by_available_supply , labelFormat , maxTicksValue ) ;
320+ private refreshMarketCapChart ( refreshChart : Function , chart : Chart , graphs : Graphs , labelFormat : string , maxTicksValue : number ) : void {
321+ refreshChart ( chart , graphs . marketCapByAvailableSupply , labelFormat , maxTicksValue ) ;
321322 }
322323
323- private refreshVolumesChart ( refreshChart : Function , chart : Chart , coinMarketCapGraphsResponse : CoinMarketCapGraphsResponse , labelFormat : string , maxTicksValue : number ) : void {
324- refreshChart ( chart , coinMarketCapGraphsResponse . volume_usd , labelFormat , maxTicksValue ) ;
324+ private refreshVolumesChart ( refreshChart : Function , chart : Chart , graphs : Graphs , labelFormat : string , maxTicksValue : number ) : void {
325+ refreshChart ( chart , graphs . volumeUsd , labelFormat , maxTicksValue ) ;
325326 }
326327
327328 private refreshChart ( chart : Chart , values : Array < Array < number > > , labelFormat : string , maxTicksValue : number ) : void {
0 commit comments