Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config option to remove labels from X/Y axis #48

Closed
sorenriise opened this issue May 5, 2014 · 6 comments
Closed

Add config option to remove labels from X/Y axis #48

sorenriise opened this issue May 5, 2014 · 6 comments

Comments

@sorenriise
Copy link

screenshot

Im needing to be able to add mini graphs in a table/ list -- the idea is that the graph should not take more space than a 1.5 line height, and hence I would want to suppress the labels on the x and y-axis, as well as suppressing the axies.

Some setting like:
$scope.config = {
labels:false,
axis: {
x: "none", // or 'lineonly', 'labels'(default)
y: "none" // or 'lineonly', 'labels'(default)
}

@chinmaymk
Copy link
Owner

For your particular case, you could just pass the x value as empty string. As of now, I don't think it is absolutely required as part of this library. Might think of it sometime later. Closing the issue.

@sorenriise
Copy link
Author

Given the richness of the D3, you should probably think of just exposing the configuration interfaces directly instead of proxy them behind a config object.

@sorenriise
Copy link
Author

.... Also -- that does not remove the y-axies lables.

@piniusha
Copy link

i must agree with Sorenriise. You should expose the config and not giving a proxy. I cannot find a way to hide X axis. The reason i want to hide it is because i have a lot of data(500 points) i want to show and there is not enough room to draw so much data - this is why i prefer not showing it.

@sorenriise
Copy link
Author

I switched to useing flot (http://www.flotcharts.org/) which pre-dates d3 but is in active development. It has all the options which is needed for most applications, and is very easy to configure .. I have included the directive I used below.

angular.module('myapp')
.directive('minichart', function(){
return{
restrict: 'E',
link: function(scope, elem, attrs){

        var chart = null,
        opts  = {
    legend:{show:false}, 
    series: {
        lines: { show: true, fill: true, fillColor: "rgba(100,0,200,1)", lineWidth:0 },
        points: { show: false }},
    yaxis: {show:false},
    xaxis: {show:false},
    grid: {borderWidth: 0.5}
    };

        scope.$watch(attrs.ngModel, function(v){
            if(!chart){
        if ($(elem).width() > 0) {
        chart = $.plot(elem, v , opts);
        elem.show();
        }
            }else{
                chart.setData(v);
                chart.setupGrid();
                chart.draw();
            }
        });
    }
};

});

HTML:
<tbody>
<tr data-ng-repeat="col in columns track by col.name">
<td>
<minichart ng-model='col.plot' />
....

CSS:
minichart {
...
}

@damiangreen
Copy link

Yes, this is a pain point for me too. Is this being worked on? Happy to contribute if not.. would be good to autohide every nth value, even perhaps with a manual override if need be..

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

No branches or pull requests

4 participants