Chart creation issues

0
Hello to the Mendix community. I require your help with integrating charts into my application. The first thing I am trying to do is to plot a static 3D line chart that represents the route of a vessel from point A to point B. The chart’s axis are: “x”: Longitude, “y”: Latitude, “z”: Wave Height. The JSON structure looks like this: Data:  [ {   "x": [-73.372306, -64.042395, -54.895667, -46.100736, -39.064791, -32.028846, -23.585712, -16.19707, -8.810228, -2.653777],   "y": [40.358449, 40.903134, 41.695475, 42.218348, 42.994603, 43.887996, 44.518052, 45.512121, 45.635167, 45.757942],   "z":  [ 7.80, 7.82, 7.78, 7.91, 7.94, 7.92, 7.98, 8.18, 8.2, 8.19 ],   "mode": "lines",   "type": "scatter3d" } ] Layout {   "font": {     "family": "Open Sans",     "size": 14,     "color": "#555"   },   "title": "3D Line, Trip from New York to France",   "showlegend": true,   "titlefont": {     "color": "#FF0000",     "size": 15   },   "legend": {},   "yaxis": {     "title": "Latitude",     "zeroline": true,     "color": "#4682B4",     "showgrid": true,     "showline": true   },   "xaxis":{       "title": "Longtitude",     "zeroline": true,     "color": "#4682B4",     "showgrid": true,     "showline": true   },   "zaxis": {     "title": "Wave Height",     "zeroline": true,     "color": "#4682B4",     "showgrid": true,     "showline": true   },   "margin": {     "l": 60,     "r": 60,     "b": 60,     "t": 60,     "pad": 10   } } The first issue I have is that I can’t label the x,y and z axis with their respective titles as shown in the layout structure above. The code has no errors but it doesn’t change the graph as you can see in the picture below: 1)What am I doing wrong and is there any guide on how to create these JSON structures anywhere apart from the Mendix Charts/AnyChart documentation and the plotly javascript reference library*? 2) Is there a way to change the starting limits on the chart? The lower and upper values are created automatically based on the data input. For example, “y” starts from “40”. Is there a way to make the chart start from different values? Let’s say 0,0,0? 3)Are there any guides (or even mendix apps I can download and study) on how to generate these chart values dynamically via the domain model and then automatically update them when making a REST API call? The guides I found so far from the mendix documentation are outdated and don’t work. 4) I am currently using the AnyChart marketplace module. Could I perhaps use a different API for chart creation? I’m interested in using matlab (https://plotly.com/matlab/3d-surface-plots/) or some other API in order to create my charts via code and display them to my application. Is this something Mendix supports or are all of my chart choices limited to the AnyChart module? I would really appreciate it if there is a guide or any form of documentation I can use to connect a different chart plotting library to mendix. I would much prefer coding my charts as I like instead of doing it the mendix way.   Thanks in advance. Any kind of input is appreciated!   *I’m currently using these documents as points of reference: 1. https://docs.mendix.com/refguide/chart-widgets/ And all the nested Chart/AnyChart documents. 2. https://plotly.com/javascript/reference/scatter3d/ The plotly library documentation.
asked
0 answers
0

Dionysius,

I have found using Chart Studio from Plot.ly to be very helpful.  This is an interactive tool where you can create the chart you want with the styles you desire and then look at the JSON that is used.  You can find this tool here: https://chart-studio.plotly.com/create/#/

 

From looking at some charts that I have created, I think the JSON needed for the axis titles looks like this:

image.png

So you'll need to change your layout JSON and domain model a bit.

 

Axis limits are set in the layout as well (I think).  Be sure to set autorange to false.

image.png

 

Using this tool you should be able to create what you want and then use that to create the JSON needed in Mendix.

Hope that helps,

Mike

answered