How to create components from addons


#1

now im using ember-cli-flot(addons) for to creat bar chart.but here i cant able to do custmization like add tooltip(on bar),legends align left,right,width resize and some others…Thanks in advance


#2

You can create your own component that extends the component in question assuming the author of the component followed this convention:

// app/components/xbutton.js

import Ember from 'ember';
import XButton from 'ember-xbutton/components/xbutton';

export default XButton;
```
as suggested in this <a href="https://gist.github.com/kristianmandrup/ae3174217f68a6a51ed5">guide. </a> This approach is important because if you override the addon component by creating a component of the exact same name, you still have access to the component the addon exported from it's own namespace that isn't merged into your apps tree. Anything in a component's `app` folder is merged into your app as if you had defined it. It's important to note that the addon's `app` folder is merged first followed by your app's `app` folder. Meaning, anything you define with the exact same name and path relative to the `app` folder as some component will be overridden by what you did. 

Getting back to your question....if you need something that is template specific, copy and paste the addon's template into your `template` folder with the same name and then make your customizations. If you need to change options for flot, you'll probably need to copy and paste their init code into your component that extends theirs and make the modifications. Or, if applicable, just make a `this._super()` call and then run your code after