当前位置: 软件>JavaScript软件
Web 图表生成库 Peek.js
本文导语: Peek.js 是一个用于 Web 应用的图表生成库,基于 D3.js 开发。特性: 面向对象可重用的图表 JSON 数据格式 易于理解和定制 示例代码: /* Charts are instantiated as objects. There are two different ways to pass data and draw...
Peek.js 是一个用于 Web 应用的图表生成库,基于 D3.js 开发。特性:
面向对象可重用的图表
JSON 数据格式
易于理解和定制
示例代码:
/* Charts are instantiated as objects. There are two different ways to pass data and draw the chart: i) by passing a data array to render() directly var trend_chart = new Trend("#trend-chart"); trend_chart.render(trend_data); ii) by setting the url to the data and calling draw() var trend_chart = new Trend("#trend-chart"); trend_chart.url = 'trend.json'; chart.draw(); */ var trend_chart = new Trend("#trend-chart"); //trend_chart.interpolate = "monotone"; //default=cardinal trend_chart.showTooltip = true; trend_chart.render(trend_data); var stacked_chart = new Stacked("#stacked-bar-chart"); stacked_chart.render(stacked_data); var compare_chart = new Compare('#compare-chart'); compare_chart.render(horizontal_bar_data); var pie_one = new Pie("#pie-one"); var pie_two = new Pie("#pie-two"); pie_one.render(pie_data_one); pie_two.render(pie_data_two); pie_one.legend("#pie-legend", pie_data_one);