How do I change the theme of a stockchart on the fly?

4 posts, 0 answers
  1. Jonathan Travis
    Jonathan Travis avatar
    20 posts
    Member since:
    Dec 2013

    Posted 24 Feb 2014 Link to this post

    For a standard chart, I just need to use the setOptions method

    curChart.setOptions({ theme: "black"});

    However, when I try this for a stock chart, I get a null reference error.  

    I looked at the documentation of the stock chart and it doesn't mention having the setOptions method.  

    Is it possible to change the theme?
  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2622 posts

    Posted 25 Feb 2014 Link to this post

    Hi Buddy,

    You are right - there is no a setOptions method for the StockChart. The only possible approach for changing the theme of Kendo UI StockChart at this point is to recreate the chart (as demonstrated in the online demos).

    Regards,
    Iliana Nikolova
    Telerik
  3. Jose Mejia
    Jose  Mejia avatar
    107 posts
    Member since:
    May 2009

    Posted 17 Jun 2015 in reply to Iliana Nikolova Link to this post

    Hi, Iliana!

    Are there any changes related to set different settings for series related to StockChart? I can change series (label, field and so on) via chart.options.series = newSeries and then refresh and redraw (or simply redraw), but I found that navigator series couldn't be changed the same way. Am I right? Now I have to recreate the chart but it is very inconvenient because I loose current view...

    Thanks in advance.

     

     

  4. T. Tsonev
    Admin
    T. Tsonev avatar
    2817 posts

    Posted 19 Jun 2015 Link to this post

    Hi,

    I'm afraid the Stock Chart does not leave much room for changing settings on the fly. Our recommendation is to re-initialize the widget.
    You can keep a reference to the original options in order to reuse and extend them:
    var options = { .... };
    $("#stock-chart").kendoStockChart(options);
    ...
    options.navigator.series[0] = { ... };
    $("#stock-chart").kendoStockChart(options);


    I hope this helps.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top