graphTablejQuery 插件

联合创作 · 2023-10-02 13:54

graphTable 提供了使用 flot 在一个简单的 HTML 表中绘制数据的能力。

使用方法:

$('#myTable').graphTable({series:'columns'})

graphTable() 最多需要两个对象作为参数:第一个是带有 graphTable 参数的对象;第二个是带有参数的对象,可以交给 flot。

graphTable 的参数让你:

  • 选择表格的哪些部分将被用于图表数据
  • 选择图形在表格中的位置以及它的大小
  • 在传递给flot之前,对单元格内容运行一个函数(例如去除美元符号)。

options for reading the table

defaults will work in most cases except you'll want to override the default args.series if your series are in columns

  • series 'rows', 'columns'
  • labels integer index of the cell in the series row/column that contains the label for the series; default is 0
  • xaxis integer index of the row/column (whatever args.series is) that contains the x values; default is 0
  • firstSeries index of the row/column containing the first series; default is 1
  • lastSeries index of the row/column containing the last series; will use the last cell in the row/col if not set; default is null
  • dataStart index of the first cell in the series containing data; default is 1
  • dataEnd index of the last cell in the series containing data; will use the last cell in the row/col if not set; default is null

graph size and position

  • position 'before', 'after', 'replace'; indicate whether the graph should go before the table, go after the table, or replace the table
  • width leave as null to use the width of the table for the width of the graph; otherwise, set to a width in pixels
  • height leave as null to use the height of the table for the height of the graph; otherwise, set to a height in pixels

data transformation before plotting

  • dataTransform function to run on cell contents before passing to flot; string -> string
  • labelTransform function to run on cell contents before passing to flot; string -> string
  • xaxisTransform function to run on cell contents before passing to flot; string -> string
浏览 1
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报