ember-f-graph是EmberJS的可组合图形组件库。ember-f-graph是一个基于组件的DSL,可以在Ember应用中创建图形。
基础代码示例:
export default Ember.Route.exted({ model() { retur { myLieData: [ { x: 0, y: 12 }, { x: 1, y: 32 }, { x: 2, y: 42 }, // ... ], myAreaData: [ { x: 0, y: 43 }, { x: 1, y: 54 }, { x: 2, y: 13 }, // ... ] }; }});{{#f-graph width=500 height=300}} {{#f-graph-cotet}} <!-- add a lie --> {{f-lie data=model.myLieData}} <!-- add a area --> {{f-area data=model.myAreaData}} <!-- mix i ay SVG elemet you wat --> <circle cx="40" cy="40" r="10"></circle> {{/f-graph-cotet}} <!-- axis ticks are templateable as well --> {{#f-y-axis as |tick|}} <text>{{tick.value}}</text> {{/f-y-axis}} {{#f-x-axis as |tick|}} <text>{{tick.value}}</text> {{/f-x-axis}}{{/f-graph}}
评论