Tubemaps管道数据展示
Tubemaps 是一个 Node.js 应用,给出一个数据集,将以管道的形式进行展示。
示例代码:
var TubeMap = require('tubemaps').TubeMap; var london = new TubeMap({ stations: csv.stations, lines: csv.lines, connections: csv.connections }); // Find information about a station var victoriaStation = london.getStationByName('Victoria'); // {conns:[{display_name: "Euston"}, ...], ..} // Find information a line var victoriaLine = london.getLineByName('Victoria Line'); // [station1, station2,..] // Find all connections in a line var conns = london.line(victoriaLine) // [{station1: #euston, station2: #warrentStreet}] // Find path between two stations var conns = london.path(euston, victoria) // [{station1: #euston, station2: #warrentStreet, line: #victoriaLine}] // Find path between two stations in a line var conns = london.path(euston, victoria, line) // [{station1: #euston, station2: #warrentStreet, line: #victoriaLine}]
评论