Open extra topbar

? – Exchange Chart Timeframe

If you are new here, please see some information on how to ask for support. Thank you!

? – Exchange Chart Timeframe

dashed-slug.net Forums Exchange extension support ? – Exchange Chart Timeframe

This topic contains 5 replies, has 2 voices, and was last updated by  alexg 1 month, 1 week ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #5107

    megeanwasson
    Participant

    Hey 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
    Megan

    #5112

    alexg
    Keymaster

    Hello 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_ready bubbling 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

    #5114

    megeanwasson
    Participant

    Awesome news 🙂

    Thanks I will try your suggestion so long.

    Kind Regards
    Megan

    #5875

    megeanwasson
    Participant

    Hi 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
    Megan

    #5879

    alexg
    Keymaster

    Hello 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 wp object 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

    #6152

    alexg
    Keymaster

    In version 0.7.0-beta of 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.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.