HumbleSoftware/Flotr2
关于
用于 JavaScript Canvas 的图形和图表。
数据与分析实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 0
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Flotr2
The Canvas graphing library.

http://groups.google.com/group/flotr2/
Please fork http://jsfiddle.net/cesutherland/ZFBj5/ with your question or bug reproduction case.
API
The API consists of a primary draw method which accepts a configuration object, helper methods, and several microlibs.
Example
var
// Container div:
container = document.getElementById("flotr-example-graph"),
// First data series:
d1 = [[0, 3], [4, 8], [8, 5], [9, 13]],
// Second data series:
d2 = [],
// A couple flotr configuration options:
options = {
xaxis: {
minorTickFreq: 4
},
grid: {
minorVerticalLines: true
}
},
i, graph;
// Generated second data set:
for (i = 0; i < 14; i += 0.5) {
d2.push([i, Math.sin(i)]);
}
// Draw the graph:
graph = Flotr.draw(
container, // Container element
[ d1, d2 ], // Array of data series
options // Configuration options
);
Microlibs
Extending
Flotr may be extended by adding new plugins and graph types.
Graph Types
Graph types define how a particular chart is rendered. Examples include line, bar, pie.
Existing graph types are found in js/types/.
Plugins
Plugins extend the core of flotr with new functionality. They can add interactions, new decorations, etc. Examples include titles, labels and selection.
The plugins included are found in js/plugins/.
Development
Build System
This project uses smoosh to build and Playwright for testing.
Commands:
makeormake all- Run tests and build the complete librarymake flotr2- Build the main flotr2 library filesmake test- Run Playwright testsnpm install- Install build and test dependencies
Testing:
Tests are executed using Playwright with npm test. The test suite includes:
- Unit tests for core functionality (Color, Graph options)
- Visual regression tests using example charts
- Chart type rendering tests
All tests run in headless Chrome for consistent, pixel-perfect rendering.
Build Outputs:
flotr2.js- Full library with dependenciesflotr2.min.js- Minified versionflotr2.nolibs.js- Library without dependenciesflotr2.ie.min.js- IE-specific build
Architecture
Flotr2 is a Canvas-based JavaScript charting library with a modular plugin-based architecture.
Core Components (js/):
Flotr.js- Main namespace, plugin/type registrationGraph.js- Primary graph constructor and rendering orchestratorSeries.js- Data series processing and normalizationAxis.js- Axis calculations and renderingColor.js,Date.js,DOM.js,Text.js- Utility modules
Chart Types (js/types/):
Chart types define rendering behavior for different visualizations:
lines.js,bars.js,pie.js,points.js- Basic chartsbubbles.js,candles.js,radar.js- Advanced chartsgantt.js,timeline.js- Timeline visualizations
Plugins (js/plugins/):
Plugins extend functionality through event hooks:
grid.js,legend.js,labels.js,titles.js- Visual elementsselection.js,crosshair.js,hit.js- Interactionsdownload.js,spreadsheet.js- Data export
Extension Pattern:
- Add chart types:
Flotr.addType(name, implementation) - Add plugins:
Flotr.addPlugin(name, implementation) - Plugins use lifecycle hooks (beforedraw, afterdraw, etc.)
Build Configuration:
Build configurations are in make/*.json files defining file concatenation order.
Shoutouts
Thanks to Bas Wenneker, Fabien Ménager and others for all the work on the original Flotr. Thanks to Jochen Berger and Jordan Santell for their contributions to Flotr2.
探索相关项目
加载中…