How could be the best way of implementing an fft chart?

Hello everyone,

I’m trying to set up an interactive cascading spectrum chart, but it hasn’t been such a trivial thing for me. Here’s a picture of the goal I’d like to achieve:

cascata-geral

It’s an fft graph, I have all these points already. Do you have any tips or any examples that I could follow?

I apologize that I don’t have any examples online yet to bring here, but as I go along I’ll add a fiddle here. I’ve tried using graphics-specific libraries, but mostly they work either with points only or with surface graphics.

Any help, guidance, examples will be a matter of great gratitude.

Best Regards,
Matheus

I have already something done in BabylonJS…
If you want you can have a look here: https://playground.babylonjs.com/#S7U8U8#1

Any additional help will be a pleasure.

Did you consider using boxgeometries positioned and scaled to the data points?
I think this will also help if you want to use raycasting to highlight individual data, as in the example image.

1 Like

I think that the solution is along on this way (bars scaled to look like what the example shows)… As the amount of data is huge in a single lane, it would make it easier to fill in the colors, and I could just use this technique of raycasting.

Hi!
Based on your Babylon.js example and that Three.js instancing example: three.js examples

There is an option with the using of InstancedMesh.

Example: https://codepen.io/prisoner849/full/GRWXwwz
Picture:

PS It’s just an option, not the ultimate solution.

3 Likes

Very good option by the way! Thanks…

I’ve seen that it’s not so trivial to make a gradient on the other axis (Y). Someway to have this effect: according to the value…
image image

Let’s suppose the highest is 100, so its bar would have from blue to red…
And if it’s 2, it would just like blue.

I searched a bit more and the solution I found is to use shaders, do you know if it’s the best way of doing that?

With some minor modifications to the material, you can have the desired colouring effect.

Example: https://codepen.io/prisoner849/full/rNyqMJJ
Picture:

2 Likes

Thank you, @prisoner849 .

I just realized I need to study more about these topics. Do you have any recommendations for what to study to help me get there to the solution I need? Could it be the famous shaders?

Would it be possible to color it in the other direction? For example, the coolest spots would be blue, and the hottest is a composite of all the other colors in a gradient. The base would always be blue on all bars, and on the larger ones, they would have more than one color.

Instead of:

Color it in this direction:

Thanks again!

I updated the codepen, now shaders take bars’ height in count to make those bars gradiental.
Picture:

1 Like