Maps in CanvasXpress allow users to create interactive and customizable visualizations for geographical data. You can integrate various map types, such as choropleths or point maps, and layer your data to highlight trends, distributions, or relationships across regions. With its flexibility, Maps in CanvasXpress support detailed analysis and presentation of spatial data for a wide range of applications.
<html> <head> <!-- Include the CanvasXpress library in your HTML file --> <link rel="stylesheet" href="https://www.canvasxpress.org/dist/canvasXpress.css" type="text/css"/> <script src="https://www.canvasxpress.org/dist/canvasXpress.min.js"></script> </head> <body> <!-- Create a canvas element for the chart with the desired dimensions --> <div> <canvas id="canvasId" width="600" height="600"></canvas> </div> <!-- Create a script to initialize the chart --> <script> // Use a data frame (2D-array) for the graph var data = false // Create the configuration for the graph var config = { "colorBy" : "ISO_A3", "decorations" : { "connections" : [{"color" : "red","source" : [40.7,-74], "target" : [37.7,-122], "type" : "spline" }, { "color" : "red", "source" : [40.7,-74], "target" : [25.7,-80.1], "type" : "spline" }, { "color" : "red", "source" : [37.7,-122], "target" : [25.7,-80.1], "type" : "splineDashed" } ], "marker" : [{"color" : "blue","coords" : [40.7,-74], "label" : "New York", "shape" : "teardrop", "size" : 5 }, { "color" : "blue", "coords" : [37.7,-122], "label" : "San Francisco", "shape" : "teardrop", "size" : 5 }, { "color" : "blue", "coords" : [25.7,-80.1], "label" : "Miami", "shape" : "teardrop", "size" : 5 }, { "color" : "green", "coords" : [41.8,-87.6], "label" : "Chicago", "shape" : "circle", "size" : 4 }, { "color" : "green", "coords" : [36.1,-115.1], "label" : "Las Vegas", "shape" : "circle", "size" : 3 }, { "color" : "black", "coords" : [42.3,-71], "label" : "Boston", "shape" : "star", "size" : 6 } ] }, "graphType" : "Map", "mapConfig" : { "center" : [34.7,-96.1], "zoom" : 3.2 }, "mapId" : "colorCountries", "showLegend" : false, "topoJSON" : "https://www.canvasxpress.org/data/json/world.geojson" } // Event used to create graph (optional) var events = false // Call the CanvasXpress function to create the graph var cX = new CanvasXpress("canvasId", data, config, events); </script> </body> </html>
<html> <head> <!-- Include the CanvasXpress library in your HTML file --> <link rel="stylesheet" href="https://www.canvasxpress.org/dist/canvasXpress.css" type="text/css"/> <script src="https://www.canvasxpress.org/dist/canvasXpress.min.js"></script> </head> <body> <!-- Create a canvas element for the chart with the desired dimensions --> <div> <canvas id="canvasId" width="600" height="600"></canvas> </div> <!-- Create a script to initialize the chart --> <script> // Create the data for the graph var data = false // Create the configuration for the graph var config = { "colorBy" : "ISO_A3", "decorations" : { "connections" : [{"color" : "red","source" : [40.7,-74], "target" : [37.7,-122], "type" : "spline" }, { "color" : "red", "source" : [40.7,-74], "target" : [25.7,-80.1], "type" : "spline" }, { "color" : "red", "source" : [37.7,-122], "target" : [25.7,-80.1], "type" : "splineDashed" } ], "marker" : [{"color" : "blue","coords" : [40.7,-74], "label" : "New York", "shape" : "teardrop", "size" : 5 }, { "color" : "blue", "coords" : [37.7,-122], "label" : "San Francisco", "shape" : "teardrop", "size" : 5 }, { "color" : "blue", "coords" : [25.7,-80.1], "label" : "Miami", "shape" : "teardrop", "size" : 5 }, { "color" : "green", "coords" : [41.8,-87.6], "label" : "Chicago", "shape" : "circle", "size" : 4 }, { "color" : "green", "coords" : [36.1,-115.1], "label" : "Las Vegas", "shape" : "circle", "size" : 3 }, { "color" : "black", "coords" : [42.3,-71], "label" : "Boston", "shape" : "star", "size" : 6 } ] }, "graphType" : "Map", "mapConfig" : { "center" : [34.7,-96.1], "zoom" : 3.2 }, "mapId" : "colorCountries", "showLegend" : false, "topoJSON" : "https://www.canvasxpress.org/data/json/world.geojson" } // Event used to create graph (optional) var events = false // Call the CanvasXpress function to create the graph var cX = new CanvasXpress("canvasId", data, config, events); </script> </body> </html>
library(canvasXpress) canvasXpress( data=FALSE, colorBy="ISO_A3", decorations=list(connections=list(list(color="red", source=list(40.7, -74), target=list(37.7, -122), type="spline"), list(color="red", source=list(40.7, -74), target=list(25.7, -80.1), type="spline"), list(color="red", source=list(37.7, -122), target=list(25.7, -80.1), type="splineDashed")), marker=list(list(color="blue", coords=list(40.7, -74), label="New York", shape="teardrop", size=5), list(color="blue", coords=list(37.7, -122), label="San Francisco", shape="teardrop", size=5), list(color="blue", coords=list(25.7, -80.1), label="Miami", shape="teardrop", size=5), list(color="green", coords=list(41.8, -87.6), label="Chicago", shape="circle", size=4), list(color="green", coords=list(36.1, -115.1), label="Las Vegas", shape="circle", size=3), list(color="black", coords=list(42.3, -71), label="Boston", shape="star", size=6))), graphType="Map", mapConfig=list(center=list(34.7, -96.1), zoom=3.2), mapId="colorCountries", showLegend=FALSE, topoJSON="https://www.canvasxpress.org/data/json/world.geojson" )