Stock Charts / Stock History

2 posts, 0 answers
  1. Boštjan
    Boštjan avatar
    1 posts
    Member since:
    Jan 2016

    Posted 08 Jan 2016 Link to this post

    "Stock Charts / Stock History" ( http://demos.telerik.com/kendo-ui/financial/stock-history )

    In the following example $("#company-filtering-tabs").kendoTabStrip was populated by local array (dataSource: ["Google", "Apple", "Amazon"]). I wonder how can I populate it from stocksDataSource and it's distinct field symbol. 

    stocksDataSource is retrieve from: http://demos.telerik.com/kendo-ui/content/dataviz/dashboards/stock-data-2011.json

    and it's structure goes like:

    [ { "date": "3/31/2011", "close": 586.76, "volume": 2028228, "open": 583, "high": 588.1612, "low": 581.74, "symbol": "1. GOOG" },

      { "date": "3/31/2011", "close": 586.76, "volume": 2028228, "open": 583, "high": 588.1612, "low": 581.74, "symbol": "1. GOOG" }, ....

      { "date": "3/31/2011", "close": 405, "volume": 6414369, "open": 403.51, "high": 406.28, "low": 403.49, "symbol": "2. AAPL" }, ....

      { "date": "13/31/2011", "close": 382.2, "volume": 14464710, "open": 381.29, "high": 382.276, "low": 378.3, "symbol": "3. AMZN" }, ....

    ]

    Thank you for your answers!

  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2788 posts

    Posted 13 Jan 2016 Link to this post

    Hi,

    Please accept my apologies for the delayed response.

    The problem boils down to extracting the unique values for the symbol field in the data array.
    There are obviously many approaches to this problem. For example, if using loadsh we can do:
        var symbols = _.uniqBy(data, 'symbol');

    The best moment to do that would be in the data source change event where all the data is available.

    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