jettro / c3-angular-directive

Contains angularjs directives that use c3js to create good looking graphs
http://jettro.github.io/c3-angular-directive/
MIT License
203 stars 98 forks source link

Axis-x-tick-directive not using format-time attr #104

Closed AesSedai closed 8 years ago

AesSedai commented 8 years ago

In line 163 of axis-x-tick-directive.js (v. 1.0.1):

var formatTime = attrs.formatTime;
if (formatTime) {
    tick.format = d3.time.format(format);
}

The variable 'format' is passed to the d3.time.format function, but the parameter is named formatTime. I've changed it to match on my local and it fixes the issue.

Also, on a side-note, will the x / y / step parameters be available for the legend directive? For my own purposes, I modified the chartLegend directive linker as follows to allow those parameters:

var position = attrs.legendPosition;
if (position) {
    legend = {"position": position};
}
var inset = attrs.legendInset;
if (inset) {
    legend = {"position":"inset","inset":{"anchor":inset}};
}
var insetX = attrs.legendInsetX;
if (insetX && inset) {
    legend["inset"]["x"] = parseInt(insetX);
}
var insetY = attrs.legendInsetY;
if (insetY && inset) {
    legend["inset"]["y"] = parseInt(insetY);
}
var insetStep = attrs.legendInsetStep;
if (insetStep && inset) {
    legend["inset"]["step"] = parseInt(insetStep);
}
jettro commented 8 years ago

Thanks for the idea and the fix, I have implemented them.