Skip to content

v0.3.0#486

Merged
masayuki0812 merged 44 commits into
masterfrom
new_arch
Aug 22, 2014
Merged

v0.3.0#486
masayuki0812 merged 44 commits into
masterfrom
new_arch

Conversation

@masayuki0812
Copy link
Copy Markdown
Member

Introduce new architecture that enables more flexible extension.

  • Basically same interface with v0.2.x
  • Introduce prototype architecture to allow us to define custom API and change the default behavior.
  • Introduce a concept of internal to keep simplicity of chart object and distinguish API (external) and internal functions and variables
  • Split c3.js into small src files in order to improve modularity
  • Introduce unit test

An example of the code base:

// same interface with the current version
var chart = c3.generate({ ... });
chart.focus(...);

// introduce internal API so that we can access internal variables and functions
chart.internal;
chart.internal.isTimeseries(); // isTimeseries is an internal function, but now we can access

// you can define custom API through c3.chart.fn
c3.chart.fn.myApi = function(){
   // isTimeseries is an internal variable, but now we can access in API definition
   this.internal.isTimeseries(); 
};
chart.myApi() // now we can call this

// you can change the behavior of internal functions through c3.chart.internal.fn
c3.chart.internal.fn.drawLine = function() {
   if (this.isTimeseries()) {
     // do something
   } else {
     // do something
   }
};

Discussion about this is here:
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/c3js/M3Enybz1Q5k

@michalkop93
Copy link
Copy Markdown
Contributor

When do you think this will be merged?

@trose
Copy link
Copy Markdown

trose commented Aug 14, 2014

👍 Thanks for getting this done quickly. This is going to make customization so much easier.

@masayuki0812
Copy link
Copy Markdown
Member Author

Hi, I'll merge this by next weekend. Thank you for waiting.

@masayuki0812 masayuki0812 merged commit ae7bc0c into master Aug 22, 2014
@lflores
Copy link
Copy Markdown

lflores commented Nov 7, 2014

Hi @masayuki0812, thank you for jour job, I use your library and is awesome, everything is too easy to use. Now my question ;).
I try to use a gauge chart, and I need to put a custom legend, to explain the thresholds used to draw it. Do you have some tutorial about extends the functionality or where I can review to learn it?. Thank you

@masayuki0812
Copy link
Copy Markdown
Member Author

@lflores Could you post as a new issue from here https://github.com/masayuki0812/c3/issues ?

@lflores
Copy link
Copy Markdown

lflores commented Nov 10, 2014

Issue #693 was created.
Thank you

@masayuki0812 masayuki0812 deleted the new_arch branch August 7, 2015 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants