受欢迎的博客标签

https://blog.csdn.net/lecepin/article/details/54632749

 

 

 

实例:实时显示交易信息

 

添加stock页面:

wxchart.js放入到pages/stock/中。

修改stock.wxml

stock.js代码:

// pages/stock/stock.js
//加载插件
var wxCharts = require('wxcharts.js');

Page({
  data: {},

  onLoad: function (options) {

    //建立连接
    wx.connectSocket({
      url: "ws://localhost:12345",
    })

    //连接成功
    wx.onSocketOpen(function() {
      wx.sendSocketMessage({
        data: 'stock',
      })
    })

    //接收数据
    wx.onSocketMessage(function(data) {
      var objData = JSON.parse(data.data);
      console.log(data);
        new wxCharts({
          canvasId: 'lineCanvas',//指定canvas的id
          animation: false,
          type: 'line',//类型是线形图
          categories: ['2012', '2013', '2014', '2015', '2016', '2017'],

          series: [{
            name: '交易量',
            data: objData,//websocket接收到的数据
            format: function (val) {
              if (typeof val == "string") {
                val = parseFloat(val);
              }
              return val.toFixed(2) + '万元';
            }
          },
          ],
          yAxis: {
            title: '交易金额 (万元)',
            format: function (val) {
              return val.toFixed(2);
            },
            min: 0
          },
          width: 320,
          height: 200
        });      
    })

    //连接失败
    wx.onSocketError(function() {
      console.log('websocket连接失败!');
    })
  },
})
 

 

实例效果:




1.微信小程序 chart 、K线图、分时图  

egchart.js

https://github.com/EGsnn/wxcharts

2.网页,小程序、app vue行情

https://github.com/jones2000/HQChart

支持前复权,后复权 支持日线,月线,周线,年线. 主图支持股票叠加 支持常用指标指标(目前以录入系统指标85个) 均线,BOLL,MACD,KDJ,VOL,RSI,BRAR,WR,BIAS,OBV,DMI,CR,PSY,CCI, DMA,TRIX,VR,EMV,ROC,MIM,FSL,CYR,MASS,WAD,CHO ..... 数据鼠标左右拖拽移动, 键盘移动十字光标移动,键盘缩放 支持通达信语法指标

3.股票网页版

https://github.com/roshanca/stock-chart

4.

https://github.com/Seedarchangel/TuChart

5.

blog:http://www.wxapp-union.com/forum.php?mod=viewthread&tid=2032&fromuid=2

https://github.com/hxbaishikele/kabul

6.股票分时图

https://github.com/zhakei988/wxapp

小程序blog

2.1 Canvas绘制股票K线图

http://www.mamicode.com/info-detail-2160652.html

2.2 小程序 - K线图画法

https://blog.csdn.net/sinat_27180253/article/details/80932177

 

app

5.各种金融类的自定义View,基金走势图、分时图、蜡烛图、各种指标等,一步一步构建庞大的基金自定View

https://github.com/Tophold/FinancialCustomerView

6.股票图,K线图,蜡烛图,高仿雪球股票,教你一步步实现股票图

blog:https://blog.csdn.net/qq_24531461/article/details/72972429

https://github.com/siyehua/KLineGraph

7.基于MPAndroidChart的专业股票图,如分时图和K线图KLine。

https://github.com/LambdaXiao/StockChart-MPAndroidChart

8.KChart for Android ;股票k线图

https://github.com/tifezh/KChartView

ios

1.

https://github.com/zhiyu/chartee

2.

https://github.com/YongbaoWang/StockChart

3.

https://github.com/chenxiaoyu3/BBStockChartView

4.iOS K线第二版:分时图,日周月K线图,五档图,长按,捏合缩放,全屏非全屏切换自适应等

https://github.com/WillkYang/YYStock