qiskit-js
qiskit-js copied to clipboard
Quantum State Visualization (with ECharts & ECharts-GL)
I am not sure if proving quantum state visualization is already in the roadmap but, one way or another, I think it might be worthy to comment here how I added this functionality to qiskit-sdk-swift.
On the contrary to the python repo where the visualization is based on matplotlib, there were nothing equivalent for Swift (that was also available on macOS, iOS & Linux); so I ended up using the following JavaScript libraries to display the graphs embedded in web views:
These libraries provided (out of the box) all I needed to plot the quantum states, also without any other dependency. They are under Apache license and behind them is a big company: Baidu, so I think we can assume they will be maintained for a while.
I hope the javascript code I wrote might serve as an example.
What is the expected behavior?
The code I mention above is located in:
- BarChartHtmlFactory.swift
- StateBlochChartHtmlFactory.swift
- StateCityChartHtmlFactory.swift
- StateQsphereChartHtmlFactory.swift
Swift & JavaScript code are mixed in the same files but I think it is quite readable.
To end, any suggestion about how to improve the existing javascript code is welcome, in fact it would be very appreciated :)