Skip to content

Commit

Permalink
srteamline KeplerGL.js, fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed May 6, 2024
1 parent f4199e3 commit 22a5218
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 37 deletions.
58 changes: 26 additions & 32 deletions assets/js/KeplerGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,43 +132,37 @@ Vue.component("VueKeplerGl", {
/** END STORE **/

/** COMPONENTS **/
const KeplerElement = (function (react, KeplerGl, mapboxToken) {
return function(props) {
return react.createElement(
'div',
{style: {position: 'relative', left: 0, width: '100%', height: '100%'}},
react.createElement(
AutoSizer,
{},
function({height, width}) {
return react.createElement(
KeplerGl.KeplerGl,
{
mapboxApiAccessToken: mapboxToken,
id: this.id,
width: width,
height: height || '100%'
}
)
}
)
const KeplerElement = function(props) {
return React.createElement(
'div',
{style: {position: 'relative', left: 0, width: '100%', height: '100%'}},
React.createElement(
AutoSizer,
{},
function({height, width}) {
return React.createElement(
KeplerGl.KeplerGl,
{
mapboxApiAccessToken: MAPBOX_TOKEN,
id: this.id,
width: width,
height: height || '100%'
}
)
}
)
}
}(React, KeplerGl, MAPBOX_TOKEN));

const app = (function createReactReduxProvider(react, ReactRedux, KeplerElement) {
return react.createElement(
ReactRedux.Provider,
{store},
react.createElement(KeplerElement, null)
)
}(React, ReactRedux, KeplerElement));
}

const app = React.createElement(
ReactRedux.Provider,
{store},
React.createElement(KeplerElement, null)
)
/** END COMPONENTS **/

/** Render **/
(function render(react, ReactDOM, app) {
ReactDOM.render(app, document.getElementById(id));
}(React, ReactDOM, app));
ReactDOM.render(app, document.getElementById(id));

return {app, store}
},
Expand Down
10 changes: 5 additions & 5 deletions examples/StippleKeplerGLDemo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ df = CSV.read(joinpath(keplergl_path, "assets", "example_data", "data.csv"), Dat

# token = "token please"

m1 = KeplerGL.KeplerGLMap(token, center_map=false)
m1 = KeplerGLMap(token, center_map=false)

KeplerGL.add_point_layer!(m1, df, :Latitude, :Longitude,
add_point_layer!(m1, df, :Latitude, :Longitude,
color = colorant"rgb(23,184,190)", color_field = :Magnitude, color_scale = "quantize",
color_range = ColorBrewer.palette("PRGn", 6),
radius_field = :Magnitude, radius_scale = "sqrt", radius_range = [4.2, 96.2], radius_fixed = false,
Expand All @@ -25,9 +25,9 @@ m1.config[:config][:mapState][:longitude]= -120.42806781055732
m1.config[:config][:mapState][:zoom] = 4.886825331541375
m1.window[:map_legend_show] = m1.window[:map_legend_active] = m1.window[:visible_layers_show] = m1.window[:visible_layers_active] = false

m2 = KeplerGL.KeplerGLMap(token, center_map=false)
m2 = KeplerGLMap(token, center_map=false)

KeplerGL.add_point_layer!(m2, df, :Latitude, :Longitude,
add_point_layer!(m2, df, :Latitude, :Longitude,
color = colorant"rgb(23,184,190)", color_field = :Magnitude, color_scale = "quantize",
color_range = ColorBrewer.palette("RdYlGn", 6),
radius_field = :Magnitude, radius_scale = "sqrt", radius_range = [4.2, 96.2], radius_fixed = false,
Expand All @@ -39,7 +39,7 @@ m2.config[:config][:mapState][:longitude]= -122.42806781055732
m2.config[:config][:mapState][:zoom] = 4.886825331541375
m2.window[:map_legend_show] = m2.window[:map_legend_active] = m2.window[:visible_layers_show] = m2.window[:visible_layers_active] = false

d1, d2 = m1.datasets, m2.datasets
d1, d2 = m1.datasets, m2.datasets;

@app begin
@out map1 = m1
Expand Down

2 comments on commit 22a5218

@hhaensel
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: Version 0.1.1 already exists

Please sign in to comment.