Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

JSON graph

New Here ,
May 10, 2018 May 10, 2018

Hello, I am using data located in a JSON file to create a graph.

In the below example, I pull a temperature # for the month of "Jan".

I would like to replace "Jan" by the current layer's name or better, by the name of the layer right below, to which I would add +1.

I have tried thisComp.layer(index).name with no luck.

eval("var variable="+footage("exportedxls.json").sourceText);

hauteur = variable[0].Jan;

min = thisComp.layer("Slider Controls").effect("Min")("Slider");

max = thisComp.layer("Slider Controls").effect("Max")("Slider");

max_movement = -thisComp.layer("Slider Controls").effect("Max Movement")("Slider")

newBaseline = thisComp.layer("Slider Controls").effect("New Baseline")("Slider");

myYheight = ((hauteur - min) / max) * max_movement + newBaseline;

myXspace = thisComp.layer(index+1).transform.position[0]+thisComp.layer("Slider Controls").effect("Space btw points")("Slider");

[myXspace, myYheight]

Would anyone be able to help me out?

Thank you,

Alex

657
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 11, 2018 May 11, 2018

And what the are the layers actually called? Where is the layer name in your code even used? What error do you get? I'm confused.

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 11, 2018 May 11, 2018

I am very new art this and confused too...

Let's focus on: "I would like to replace "Jan" by the current layer's name". (whatever the name of the layer would be)

Would this be possible?

Thanks for your help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 11, 2018 May 11, 2018

Sure, but your are still not really explaining what specifically the issue is. Your layer.name construct should work, so the real question becomes what error you are running into. String conversion issues? Don't know where to place the code? What else?

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 11, 2018 May 11, 2018
LATEST

This is my JSON file:

[{"p1":"0.1"}]

Works:The below code will return the value 0.1:

eval("var variable="+footage("exportedxls.json").sourceText);

hauteur = variable[0].p1;

Does not work: The below code will not return any value:

eval("var variable="+footage("exportedxls.json").sourceText);

hauteur = variable[0].thisComp.layer(index).name;

Note that the layer's name is p1.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines