syntagmatic / parallel-coordinates

A d3-based parallel coordinates plot in canvas. This library is no longer actively developed.
http://syntagmatic.github.com/parallel-coordinates/
Other
511 stars 212 forks source link

Can't find yscale function while trying to specify a scale #308

Closed shakedk closed 8 years ago

shakedk commented 8 years ago

Hi,

As mentioned in the API, the y-axis scale can be specified manually: " Dimension attributes include: .... "yscale": Type of scale to use for the axis(log, linear, ordinal ... "

I created a dimensions variable as follows: var dimensions = { "AreaID" : { title : 'Area ID', yscale: 'log' }, };

Then I added it to the parcoords variable:

                        parcoords = d3.parcoords()("#parallelCoords").data(
                                data).hideAxis([ "name" ]).color(color)                                 .dimensions(dimensions).detectDimensions().render().alpha(0.7)
                                .render().shadows().reorderable()
                                .composite("darken").margin({
                                    top : 24,
                                    left : 150,
                                    bottom : 12,
                                    right : 0
                                }).mode("queue").render().brushMode(
                                        "1D-axes");

When I run the code, I get the following error: Uncaught TypeError: __.dimensions[p.key].yscale is not a function (line 630 in d3.parcoords.js)

When I remove the yscale property, everything works ok and the title is changed as specified.

Any idea what am I might be doing wrong?

Thanks for this awesome tool, Shaked.

BroHammie commented 8 years ago

Documentation is lacking... You need to define a d3 scale like in the axis-config example:

var range = parcoords.height() - parcoords.margin().top - parcoords.margin().bottom;
var min = d3.min(data, function(d) {
    return parseInt(d['displacement (cc)']);
});
var max = d3.max(data, function(d) {
    return parseInt(d['displacement (cc)']);
});
var log = d3.scale.log().domain([min, max]).range([range, 1]);
shakedk commented 8 years ago

Thanks @mcwillso !