解決方案
上下文就是一切! 就像人們可能想在文字區塊中嵌入微小的折線圖一樣迷你圖為了在討論的背景下顯示它們,有人可能希望在地圖中嵌入微小的條形圖,以比較其位置背景下的變數。 像我們自己一樣的人@scwise ,誰在願望清單條目。
此解決方案可以使用兩個最新的 JMP 功能來實現 - 虛擬連接和使用表格單元格中的圖像作為標記的功能。 結合圖形產生器從複合圖中建立包含圖形元素的資料表的功能,我們擁有解決此難題所需的所有部分。 最終結果如下圖所示:
US Elections 2008: Obama vs McCainUS Elections 2008: Obama vs McCain2008 年美國大選:歐巴馬 vs 麥凱恩
詳情如下:
dt1 = Open("$SAMPLE_DATA/US Election 2008.jmp");
// Create per state graphs
gb1 = Graph Builder(
Variables( Y( :Obama ), Y( :McCain, Position( 1 ) ), Page( :State ) ),
Elements( Bar( Y( 1 ), Y( 2 ), Legend( 8 ), Summary Statistic( "Max" ) ) ),
SendToReport(
Dispatch(
{},
"",
ScaleBox( 2 ),
{Min( -0.657608695652174 ), Max( 0.657608695652174 ), Inc( 0.25 ),
Minor Ticks( 0 )}
),
Dispatch(
{},
"",
ScaleBox( 3 ),
{Min( -0.657608695652174 ), Max( 0.657608695652174 ), Inc( 0.25 ),
Minor Ticks( 0 )}
),
Dispatch( {}, "400", LegendBox, {Set Title( "" )} )
)
);
// Save graphs as images to data table
dt2 = gb1 << Make into Data Table;
// Tip: save table to enable virtual join
dt2 << Save("$TEMP/ElectionPerStateGraph.jmp");
// Set virtual join between tables
dt2:State << Set Property("Link ID", 1);
dt1:State << Set Property(
"Link Reference",
Reference Table( "$TEMP/ElectionPerStateGraph.jmp" ));
// Use virtually joined graph column as source for markers
col = Column(dt1, "Graph[State]");
col << UseForMarker( 1 );
// Create map with a points overlay using graph markers
dt1 << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( Shape( :State ) ),
Elements( Map Shapes( Legend( 2 ) ), Points( Legend( 3 ) ) )
);