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

Reordering axes. #289

Closed
viko123 opened this issue Mar 27, 2016 · 10 comments
Closed

Reordering axes. #289

viko123 opened this issue Mar 27, 2016 · 10 comments

Comments

@viko123
Copy link

viko123 commented Mar 27, 2016

Hi,
I want to reorder the axes based an predefined order ( [1,3,4,2...]). I've tried the following
Note: I have reorderable() already swtiched on

parcoords
.detectDimensions()
.dimensions("imgH","imgW")
.render()
.updateAxes();

and

parcoords.dimensions([3,1,2])
.render()
.updateAxes();

for both of which I get the following error: defaultScales[__.dimensions[k].type] is not a function.

I have also tried:
dimensionObj = {"0": {title: "imgH"}, "1": {title: "imgW"}}
parcoords
.dimensions(dimensionObj);

and reorder() as
parcoords.reorder([3,1,2]).render().updateAxes()

All to no avail.
Can somebody please guide me as to how to go about reordering the axes. (Please note I'm not very experienced with js and CG in general).

Thank you,
V

@BroHammie
Copy link
Collaborator

In your dimensionObj add an index property specifying the desired x-axis
position. Like:
dimensionObj = {"0": {title: "imgH", index: 1}, "1": {title: "imgW", index:
0}}
On Mar 27, 2016 11:02 AM, "viko123" notifications@github.com wrote:

Hi,
I want to reorder the axes based an predefined order ( [1,3,4,2...]). I've
tried the following
Note: I have reorderable() already swtiched on

parcoords
.detectDimensions()
.dimensions("imgH","imgW")
.render()
.updateAxes();

and

parcoords.dimensions([3,1,2])
.render()
.updateAxes();

for both of which I get the following error:
defaultScales[__.dimensions[k].type] is not a function.

I have also tried:
dimensionObj = {"0": {title: "imgH"}, "1": {title: "imgW"}}
parcoords
.dimensions(dimensionObj);

and reorder() as
parcoords.reorder([3,1,2]).render().updateAxes()

All to no avail.
Can somebody please guide me as to how to go about reordering the axes.
(Please note I'm not very experienced with js and CG in general).

Thank you,
V


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#289

@viko123
Copy link
Author

viko123 commented Mar 27, 2016

Hi,
Thanks, I tried that -

dimensionObj = {"0": {title: "imgH", index:1}, "1": {title: "imgW", index:0}}
        parcoords
        .detectDimensions()
        .dimensions(dimensionObj)
        .render()
        .updateAxes();

and i'm still getting:
TypeError: defaultScales[__.dimensions[k].type] is not a function

Just for reference -
The rest of my pcord setup (prior to this bit; this bit is separately linked to a button) is:

var parcoords = d3.parcoords()("#pcoord")
        .color(color)
        .alpha(0.9);
...
parcoords
        .data(data)
        .composite("darker")
        .autoscale()
        .shadows()
        .reorderable()
        .brushMode("1D-axes") // enable brushing
        .bundlingStrength(0) // set bundling strength
        .smoothness(0)
        .bundleDimension('199')
        .render();  

My data is all numeric with string based headers such as [...,FftPMo2,FftPMo3,FftPMo4,FftAMi1,FftAMi2,FftAMi3 ...] and is loaded using d3.csv.

V

@BroHammie
Copy link
Collaborator

Grab the latest I am sure this will fix your issue. Terrible oversight on my part.

@viko123
Copy link
Author

viko123 commented Mar 28, 2016

Hi,
Thanks for all your help. I got the latest version but the error messages still persists.

V

@BroHammie
Copy link
Collaborator

dimensionObj = {"0": {title: "imgH", index:1}, "1": {title: "imgW", index:0}} would be used if the data variable you passed to parcoords is an array of arrays.

Otherwise you would pass the key for the attribute value you want to pull from the object:
dimensionObj={"imgH": {index:0}, "imgW": {index:1}

Can you post subset of your data? IE: JSON.stringify(parcoords.data()[0])

@viko123
Copy link
Author

viko123 commented Mar 28, 2016

"{"199":"2","CRMo2":"0.826815","CCMi6":"0","GS3O5Mi1":"0.050249","CRMo4":"1.87072","CCMi4":"0","CCMi3":"0","CCMi1":"0","CCMi2":"0","CRMo3":"0.268288","GS2O5Mi1":"0.097675","CCMi7":"0","GS1O6Mi7":"-0.001526","GS2O4Mi7":"-0.000124","GS1O6Mi5":"0.004258","GS3O5Mi2":"0.00015","GS1O4Mi7":"-0.006087","CCMi5":"0","GS1O3Mi6":"0.40988","GS1O8Mi5":"0.001754","GS1O5Mi1":"0.1485","GS1O7Mi1":"1.7849","BkSAZO5R3":"0.039949","BkSAZO5R1":"0.1064","GS2O1Mi2":"0.000614","GS2O7Mi5":"0.021432","GS2O3Mi7":"-0.01988","GS3O7Mi6":"0.000102","GS3O6Mi3":"0.001652","GS1O1Mi1":"0.10793","GS2O8Mi5":"0.000048","bkcol":"37807","GS3O4Mi6":"-0.000049","GS1O1Mi2":"0.001181","GS2O1Mi1":"0.079627","GS3O3Mi6":"0.000038","BkSAZO3R1":"0.2288","GS2O3Mi6":"0.15073","GS3O3Mi4":"0.000509","GS2O5Mi4":"0.000054","GS2O3Mi5":"0.082916","GS2O2Mi5":"0.000103","GS3O8Mi6":"0.000667","FftAMo4":"137250","GS2O8Mi4":"0.006933","GS2O4Mi4":"0.020837","GS1O7Mi6":"0.098183","GS1O6Mi1":"1.0405","GS2O3Mi4":"0.2811","GS2O2Mi4":"0.010415","GS1O4Mi1":"0.82257","GS1O5Mi4":"0.000203","GS2O8Mi7":"0.000037","FftAMi1":"0.000067","GS1O8Mi7":"-0.000482","GS2O1Mi3":"0.000002","GS2O7Mi4":"0.12582","GS2O7Mi1":"1.2901","BkSPZO3R3":"79.651","GS2O5Mi2":"0.001286","FftAMo3":"345.07","GS2O6Mi6":"0.003529","GS2O7Mi7":"-0.014641","GS2O6Mi4":"0.017319","GS2O3Mi1":"1.3482","GS3O7Mi1":"0.61525","GS3O7Mi4":"0.00147","GS3O6Mi4":"0.00041","GS1O3Mi5":"0.31199","GS2O2Mi6":"0.001897","GS3O8Mi3":"0.006932","GS2O7Mi6":"0.059427","GS1O5Mi2":"0.001721","GS1O8Mi4":"0.036932","GS1O2Mi4":"0.027801","GS1O7Mi4":"0.11185","GS3O4Mi4":"0.000524","GS2O6Mi1":"0.78995","GS1O1Mi4":"0.000009","GS1O1Mi3":"0.000015","BkSAZO1R1":"0.23781","imgH/imgW":"0.24157","GS2O5Mi3":"0.000027","GS1O6Mi4":"0.046548","GS2O8Mi6":"0.001141","GS3O3Mi1":"0.64203","GS1O3Mi4":"0.45099","GS3O2Mi3":"0.004207","GS3O8Mi2":"0.012121","GS3O4Mi1":"0.51824","GS1O2Mi7":"-0.000342","GS1O2Mi5":"0.001194","GS3O1Mi1":"0.046715","GS1O4Mi4":"0.085467","BkSPZO3R1":"-128.95","GS3O1Mi2":"0.000154","GS2O4Mi1":"0.78126","GS2O4Mi6":"0.004125","GS1O7Mi2":"0.95716","BkSPZO2R2":"-117.89","GS3O7Mi3":"0.00283","GS3O2Mi4":"0.008036","GS3O8Mi4":"0.006585","GS1O3Mi1":"1.79","GS1O3Mi7":"-0.16791","GS1O8Mi3":"0.065687","GS3O3Mi3":"0.001374","GS1O7Mi3":"0.95278","BkSAZO2R2":"0.17897","GS1O2Mi3":"0.071752","GS1O7Mi5":"0.030426","bkperC":"17.65","GS2O2Mi7":"0.000033","GS1O4Mi2":"0.087751","GS1O6Mi6":"0.01808","GS2O4Mi3":"0.032055","GS3O7Mi2":"0.005312","imgH":"437","GS3O6Mi2":"0.007531","GS3O4Mi3":"0.000698","GS1O7Mi7":"-0.020184","GS2O3Mi3":"0.32732","GS2O6Mi2":"0.04811","BkSPZO1R1":"35.815","GS1O8Mi6":"0.011352","GS1O4Mi6":"0.023911","GS1O2Mi6":"0.009458","GS1O3Mi3":"1.3685","GS2O1Mi4":"0.000002","GS2O3Mi2":"0.29154","GS2O2Mi3":"0.010403","GS2O8Mi3":"0.010931","imgW":"1809","FftPMi1":"1.0637E47","FftPMi3":"-4.814E141","FftPMi4":"-4.814E141","GS3O6Mi1":"0.50287","GS2O7Mi3":"0.33825","GS3O2Mi6":"0.000874","BkSAZO3R3":"0.12697","GS2O2Mi1":"0.73645","GS2O8Mi1":"0.74891","GS3O4Mi2":"0.00948","GS1O4Mi3":"0.14869","GS2O7Mi2":"0.26412","GS2O4Mi2":"0.043354","GS3O2Mi1":"0.58805","GS1O6Mi2":"0.16518","FftPMo2":"0.99999","FftAMi2":"0","FftPMo3":"0","FftPMo4":"1.7966","GS1O8Mi1":"0.99849","GS2O8Mi2":"0.044525","FftAMi3":"0","GS3O8Mi5":"0.000044","GS3O8Mi1":"0.57618","FftAMi6":"0","FftAMi5":"0","FftAMi4":"0","GS1O6Mi3":"0.2028","GS2O6Mi5":"0.000391","FftAMo2":"0.99999","GS1O8Mi2":"0.095013","BkSPZO4R2":"92.074","GS3O7Mi7":"-0.000002","GS2O6Mi3":"0.029409","BkSPZO5R3":"-74.709","GS3O7Mi5":"0.000002","BkSPZO5R1":"69.089","GS3O6Mi7":"0","GS3O6Mi6":"-0.000005","GS2O6Mi7":"0.000003","BkSAZO4R2":"0.14821","GS3O6Mi5":"0","FftAMi7":"0","GS3O5Mi6":"0","FftPMi2":"1.1314E94","GS3O4Mi7":"0","GS2O2Mi2":"0.042451","GS2O4Mi5":"0.000524","GS1O5Mi3":"0.000092","GS1O5Mi5":"0","GS1O5Mi6":"0.000006","GS1O2Mi2":"0.11598","GS1O2Mi1":"1.0079","GS3O4Mi5":"0","GS3O2Mi2":"0.012913","FftPMi5":"2.3175E283","GS3O8Mi7":"-0.000008","GS3O3Mi2":"0.010779","GS3O2Mi5":"0.000047","GS3O3Mi5":"0","GS3O3Mi7":"0","GS1O3Mi2":"0.89452","GS1O4Mi5":"0.007468","GS3O2Mi7":"0.000004","GS3O1Mi7":"0","GS3O1Mi6":"0","GS3O1Mi5":"0","GS1O1Mi5":"0","GS1O1Mi6":"0","GS3O1Mi4":"0","GS3O5Mi4":"0","GS3O5Mi5":"0","GS3O5Mi7":"0","FftPMi7":"4.2563E267","FftPMi6":"-5.1206E188","GS1O1Mi7":"0","GS3O5Mi3":"0","GS2O5Mi7":"0","GS2O5Mi5":"0","GS3O1Mi3":"0","GS1O5Mi7":"0","GS2O1Mi7":"0","GS2O5Mi6":"0.000002","GS2O1Mi6":"0","GS2O1Mi5":"0","branch":0}"

@BroHammie
Copy link
Collaborator

Did you try: dimensionObj={"imgH": {index:0}, "imgW": {index:1}}?

@viko123
Copy link
Author

viko123 commented Mar 29, 2016

yes, I tried both

 dimensionObj = {"imgH":{"index":1},"imgW":{"index":0}};
and
dimensionObj = {"imgH":{index:1},"imgW":{index:0}};

The rest was the same

parcoords
        .detectDimensions()
        .dimensions(dimensionObj)
        .render()
        .updateAxes();

both give the same error message:
TypeError: defaultScales[__.dimensions[k].type] is not a function

If I leave out the reordering button the chart renders and gives the following response to console.log(JSON.stringify(parcoords.dimensions()))


{"199":{"orient":"left","ticks":5,"innerTickSize":6,"outerTickSize":0,"tickPadding":3,"type":"number","index":0},"GS1O1Mi2":{"orient":"left","ticks":5,"innerTickSize":6,"outerTickSize":0,"tickPadding":3,"type":"number","index":1}, 
...

@BroHammie
Copy link
Collaborator

Can you post a gist or jsfiddle?

@berci-i
Copy link

berci-i commented Apr 9, 2021

parcoords
.dimensions(...)
.render()
Seems to throw that error if there is no element matching any one of the key inside the dimensions array in general (in my previous experience). Here it doesn't seem the case (because I can see you have both keys).

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

3 participants