感谢各位专家!
http://worldmap.ifnews.com/chinamap/china/fmap
h = [=>];
h["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36";
h["Accept"] = "application/json, text/javascript, */*; q=0.01";
h["Referer"] = "http://worldmap.ifnews.com/chinamap/china/fmap";
h["X-Requested-With"] = "XMLHttpRequest";
u = "http://worldmap.ifnews.com/chinamap/china/financialData?type=all";
rs = New HTTP Request(URL(u), Method("GET"), Headers(h));
rr = rs << Send;
If( !Is Missing( rr ),
txt = Blob To Char( rr );
dt = JSON To Data Table( txt );
dt << Set Name( "map" );
dt:price << Data Type( Numeric ) << Modeling Type( Continuous );
dt:priceLimit << Data Type( Numeric ) << Modeling Type( Continuous );
dt:changeAmount << Data Type( Numeric ) << Modeling Type( Continuous );
dt:countryCName << Set Property( "Map Role", {Map Role( NameName, Map Name( "World", "Countries" ) )} );
dt << Graph Builder(
Size( 800, 600 ),
Show Control Panel( 0 ),
Variables( Shape( :countryCName ), Color( :priceLimit ) ),
Elements( Map Shapes( Legend( 5 ) ) ),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
5,
Properties(
0,
{gradient(
{Color Theme( "Red to Green" ),
Reverse Gradient( 1 )}
)},
Item ID( "priceLimit", 1 )
)
)}
)
)
);
);

如何使用 JMP 中的 JSL 实现光标指向网页上显示内容的效果?
http://worldmap.ifnews.com/chinamap/china/fmap 
当光标指向地图上的某个国家/地区范围时,就会弹出数据。
谢谢!
或者,您可以编辑 HoverLabel 的“图片”脚本,以触发您想要的任何操作:
打开网页
- 在图表中显示更多信息
- 另开一个地块……
更多详情请见此帖:
回复:鼠标悬停时的操作? - 使用修饰键:backhand_index_pointing_right::white_square_button:
这种方法的优点:
悬停标签能够识别鼠标当前所在国家/地区,无需查找:
:Country[local:_firstrow]
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/World Demographics.jmp" );
mapxy = Open( "$MAPS/World-XY.jmp" );
mapname = Open( "$MAPS/World-Name.jmp" );
mapname << New Column( "X", Format( "Longitude DDD", "PUNDIR", 14, 4 ) );
mapname << New Column( "Y", Format( "Latitude DDD", "PUNDIR", 14, 4 ) );
For Each( {rw}, Index( 1, N Rows( mapname ) ),
shapeID = mapName:ShapeID[rw];
rws = mapxy << get rows where( :ShapeID == shapeID & :PartID == 1 );
xs = mapxy[rws, "X"];
ys = mapxy[rws, "Y"];
{x, y} = Polygon Centroid( xs, ys );
mapname:x[rw] = x;
mapname:y[rw] = y;
);
dt << Update( With( mapname ), Match Columns( :Territory = :Region ), Add Columns from Update Table( :X, :Y ) );
New Namespace(
"hover"
);
hover:GDP = 0;
hover:x = 0;
hover:y = 0;
gb = Graph Builder(
Variables( Color( :GDP per Capita ), Shape( :Territory ) ),
Elements( Map Shapes() ),
SendToReport(
Dispatch( {}, "", ScaleBox,
{Format( "Longitude DDD", "PUNDIR", 16 ), Min( 0 ), Max( 30 )}
),
Dispatch( {}, "", ScaleBox( 2 ),
{Format( "Latitude DDD", "PUNDIR", 16, 0 ), Min( 40 ), Max( 50 )}
),
Dispatch( {}, "Graph Builder", FrameBox,
{Set Graphlet(
Picture(
hover:GDP = :GDP per Capita[local:_firstrow];
hover:x = :X[local:_firstrow];
hover:y = :y[local:_firstrow];
//approach1: select the current country and trigger an update -> nice, but draggy
//local:_dataTable << Clear Select << select rows(local:_firstrow);
gb << inval;
gb << updatewindow;
)
)}
)
)
);
fb1 = Report( gb )[FrameBox( 1 )];
fb1 << addgraphicsscript(
x = hover:x;
y = hover:y;
Text( center justified, {hover:x, hover:y}, "GDP: " || Char( Round( hover:GDP ) ) );
);
悬停标签是否知道鼠标的当前位置?
遗憾的是,本地:_xaxis/_yaxis=0 。
作为一种变通方法,我采用了这种方法。
https://community.jmp.com/t5/Discussions/exporting-x-amp-y-values-coordinates-from-graph-builder-once-jmp/mp/193660/highlight/true#M41407 @johnmoore计算国家的质心 - 显示 GDP。
作为替代方案,可以使用 Mousetrap(除了 Hover Label 变通方法之外)来获取鼠标的位置。
缺点:交互性较差,因为用户必须按下鼠标按钮。