dashed-slug.net › Forums › Exchange extension support › ? – Exchange Chart Timeframe
Tagged: Chart, event, markets, shortcodes, static, static shortcodes, static templates, timeframe
- This topic has 5 replies, 2 voices, and was last updated 6 years, 6 months ago by alexg. 
- 
		AuthorPosts
- 
		
			
				
November 25, 2018 at 12:20 pm #5107megeanwasson ParticipantHey Alex, I hope you are well 🙂 
 On the exchange display page where we add the chart shortcode, is there a way to change the default Timeframe to start off with showing 1d instead of 30m?This is not urgent so your help when you can 🙂 Kind Regards 
 MeganNovember 26, 2018 at 6:44 am #5112alexg KeymasterHello Megan, This is not currently easy to do. Actually I am currently working on a big change that will allow shortcodes to do things like that. First I will roll out these changes to the parent plugin, possibly later today if all goes well, or early within the week. After that, I will apply similar changes to the Exchange extension. I will try to do this as well. In any case, the timeframe can be controlled via JavaScript. To set the knockout observable to 1 hour candlesticks, you would do: wp.wallets.viewModels.walletsExchangeChart.selectedTimeframe('1h');You could attach this to the wallets_exchange_readybubbling event, like so:$( 'html' ).on( 'wallets_exchange_ready', function( event, markets ) { wp.wallets.viewModels.walletsExchangeChart.selectedTimeframe('1h'); } );The available timeframes are: ‘1m’, ‘3m’, ‘5m’, ’15m’, ’30m’, ‘1h’, ‘4h’, ‘1d’, ‘1w’ Hope this helps. with regards November 26, 2018 at 7:56 am #5114megeanwasson ParticipantAwesome news 🙂 Thanks I will try your suggestion so long. Kind Regards 
 MeganFebruary 18, 2019 at 8:42 am #5875megeanwasson ParticipantHi Alex, I hope you are well 🙂 
 I am finally getting to try this, I am not quite sure where you suggesting that I put this code suggestion?
 You assistance/advice will be appreciated 🙂
 Regards
 MeganFebruary 19, 2019 at 7:48 am #5879alexg KeymasterHello Megan, The above JavaScript code can be added by enqueueing it as part of your child theme. Use wp_enqueue_script()in your functions.php file to reference the .js file: https://developer.wordpress.org/reference/functions/wp_enqueue_script/You should not have to worry about dependencies: the code does not reference the wpobject on the first pass. If the event is trigerred, this means that all the prerequisites have already been loaded. Simply give a unique handle and the path to the script, like so:wp_enqueue_script('my-wallets-exchange-js', '/path/to/your/javascript.file.js' );If you don’t want to enqueue the script, there are also plugins that let you easily add JavaScript tags to your pages. For example, with a quick search I found this: https://wordpress.org/plugins/header-and-footer-scripts/ with regards April 10, 2019 at 5:03 pm #6152alexg KeymasterIn version 0.7.0-betaof the Exchange extension, if you choose to use the new static templates, you can specify an initial timeframe for your chart. For example:[wallets_exchange_chart template="static" market="BTC_LTC" timeframe="1h"]. This will not work with the previous dynamic template (default).Please see the full release notes here: https://www.dashed-slug.net/static-exchange-templates/ and the accompanying documentation for more examples of what shortcodes you can use. 
- 
		AuthorPosts
- You must be logged in to reply to this topic.

