Open yitang opened 8 years ago
Yes
the plotly
library is available through the MapThing API itself, currently only in MTContainer.modalChart
.
You can of course just require(plotly)
yourself and create the necessary elements, perhaps in a modal dialog etc...
Documentation is limited at the moment: https://github.com/JamesRamm/MapThing/blob/master/docs/api/dom.md#containermodalchartdata
and you should consider the API a rough 'beta', but basically it uses the Plotly.newPlot
function and passes the data.chartData
and data.chartLayout
properties to it:
https://plot.ly/javascript/plotlyjs-function-reference/
More work on exposing more of plotly to different parts of MapThing is welcome!
@yitang Do you imagine such plots to be 'stand alone' - i.e. nothing to do with the map itself or that a plot is created by some action on the map? (e.g. someone clicks on a marker and a chart is popped up, something like this)
@JamesRamm i think it would be quite useful to have re-active plots which summarise the statistics of the current viewing region on the map (or the selected region).
Hmmm what kind of statistics? I'm thinking of providing some kind of functionality to open a plot in a different window and leaving it up to the plugin developer to link it to the map. Perhaps making it easier to add a callback function for when the map is moved. Something like
let mctrl = getMapCtrl()
mctrl.on('moveend', myCallback)
function myCallback(){
//Do work to update plot here
}
And some kind of API to create a plot which has references to the map or certain map layers? This would be a bit more expanded than the current plotting api
For example, a histogram of the flood depth?
On 29 Sep 2016, at 16:52, James Ramm notifications@github.com wrote:
Hmmm what kind of statistics? I'm thinking of providing some kind of functionality to open a plot in a different window and leaving it up to the plugin developer to link it to the map. Perhaps making it easier to add a callback function for when the map is moved. Something like
let mctrl = getMapCtrl() mctrl.on('moveend', myCallback)
function myCallback(){ //Do work to update plot here } And some kind of API to create a plot which has references to the map or certain map layers? This would be a bit more expanded than the current plotting api
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Ok, so as mapPig is a generic tool for mapping/visualisation, it doesnt know anything about flood maps etc. However, you can use it for this, but most of the development would be done by you (the plugin developer) in writing a plugin to load flood data and compute statistics on it.
I think, the best way to go about this would be:
let mc = getMapCtrl; let pos = mc.getPosition()
will return an object, pos
where pos.bbox
is the bounding box of the map) in order to get the histogram and display that in a chart.I think that the mapPIG development I suggested earlier - namely, a plotting API which allows you to create separate windows for the plot - is all that is required in mapPIG to allow this. You would use the mctrl.on
function to add a callback to update the plot when the map moves.
From a user perspective, I imagine the plugin would simply add a panel which would allow the user to
Hey, I wonder if MapThing would be suitable for generating statistical plots like this.