Je355804
Posts: 17
Joined: Tue Oct 04, 2022 9:01 am

Formula Bar

I've seen a few sites that allow you to manipulate any number of series with a formula bar such as shown in the picture below. Basically each series is assigned a unique ID (in this case m1 and m2) and then these can be manipulated with the formula function - so in the example here, f1 = m1/m2. The chart will then show the manipulation of the two series.

Would anyone be able to point me in the right direction of how this is accomplished?

Image
Attachments
2022-10-04 07_57_06-Glassnode Studio - On-Chain Market Intelligence.png
2022-10-04 07_57_06-Glassnode Studio - On-Chain Market Intelligence.png (107.66 KiB) Viewed 273 times
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Formula Bar

Hello there,

Welcome to our forum and thank you for contacting us with your question!

Well, your feature is simple and complex at the same time, but it sounds amazing and definitely is worth trying!
The main complexity comes from actually figuring out the mathematical calculations that you would need to perform in JavaScript, while the Highcharts part is super simple and I will gladly guide you through it.

When we look at your feature from the JS perspective, you would have to implement:
- an input field, and then grab specific formulas from it,
- a JS function which will calculate and convert that input to a dataset, which will be an array of arrays, or array of objects.
- a Highcharts method to add a series to your existing chart.

To achieve the last one, once you have the data as a single array, simply use the Chart.addSeries method.
Read more about it here: https://api.highcharts.com/class-refere ... #addSeries
See it in action: https://jsfiddle.net/BlackLabel/1rt7dgc3/

The whole JS calculation is on your side, but if you will encounter any issues while implementing it in your chart, please do not hesitate to contact us here,
Good luck!
Kamil Musiałowski
Highcharts Developer
Je355804
Posts: 17
Joined: Tue Oct 04, 2022 9:01 am

Re: Formula Bar

Thanks for the response Kamil, I'll keep you posted on how it goes!
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Formula Bar

Sure thing! Let me know once you'll need some assistance with the implementation,

Best regards!
Kamil Musiałowski
Highcharts Developer

Return to “Highcharts Usage”