【问题标题】:Showing forex rates with Shield UI Chart使用 Shield UI 图表显示外汇汇率
【发布时间】:2013-07-22 08:55:58
【问题描述】:

我想使用 Shield UI Chart 来访问和可视化外汇数据。我已经想出了如何做 ajax 的东西:

$.ajax({
  url: 'http://api.apirates.com/jsonp/update',
  dataType: 'jsonp',
  success: function (data) {
 }
)

但是我不知道如何从检索到的数据中提取所需的货币汇率。

【问题讨论】:

  • 响应数据的结构是什么?

标签: javascript jquery ajax shieldui


【解决方案1】:

可用费率作为键索引数组返回。可以通过类似于以下方式检索它们:

data.ticks.EURUSD,

并包含一个值,由每个 ajax 调用返回。您可以进一步将尽可能多的汇率分配给数组,然后将它们传递给图表。您需要声明数组:

var EURUSD = new Array();
and than pass it to the chart: 
     dataSeries: [
                 {
                 seriesType: 'line',
                 collectionAlias: 'EUR/USD',
                 data: EURUSD,
                 }
    ]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多