시간에 따라 카테고리가 변하는 타임라인 가로 막대 차트 만들기안녕하세요 여러분,
서로 다른 기간 동안 서로 다른 범주에 속하는 여러 단위가 포함된 데이터 테이블이 있습니다.이 데이터 세트는 다음과 같이 데이터 테이블에 정의됩니다. (i) 장치 식별자(이산 번호), (ii) 시작 날짜, (iii) 종료 날짜 및 (iv) 카테고리의 4개 데이터 열이 있습니다.카테고리 열에는 시작 시간과 종료 시간 사이에 장치가 속하는 카테고리가 나열됩니다.특정 단위에는 다양한 기간에 해당하는 여러 행의 데이터가 있을 수 있습니다.데이터 테이블은 첨부된 바와 같습니다.
X축을 시간으로, Y축을 단위로 사용하여 각 단위에 대해 지정된 기간 동안 색상별로 카테고리를 표시하는 가로 막대 차트가 필요한 그래프를 만들려고 합니다.그래프가 어떻게 보이는지 보여주기 위해 그래프 스케치를 첨부하고 있습니다.스케치는 그래프에 대한 내 아이디어를 이끌어내는 것입니다.
나는 최선을 다했지만 내가 찾고 있던 것을 얻을 수 없었습니다.이에 대한 귀하의 도움에 감사드립니다.그래프 빌더나 JSL 스크립트를 사용하는 것이 좋습니다.JMP 16 pro를 사용하고 있습니다.
데이터 탐색 및 시각화Re: 시간에 따라 카테고리가 변하는 타임라인 가로 막대 차트를 만듭니다.확장할 수 있어야 하는 스크립트의 시작 부분은 다음과 같습니다.한 줄에 여러 범위를 허용하지 않는 Gantt 추가 기능을 실행하고 원하는 작업을 수행하는 스크립트에 일부 항목을 추가했습니다.

Names Default To Here( 1 );
dt = Current Data Table();
gb = Graph Builder(
Size( 1121, 626 ),
Show Control Panel( 0 ),
Variables(
X( :Start Date ),
X( :End Date, Position( 1 ) ),
Y( :Unit/*, Order By( :Start Date, Descending, Order Statistic( "Mean" ) )*/ )
),
Elements( Bar( X( 1 ), X( 2 ), Y, Legend( 32 ), Bar Style( "Range" ) ) ),
SendToReport(
Dispatch(
{},
"Start Date",
ScaleBox,
{Min( 3790824458.85 ), Max( 3734876513.055 ), Interval( "Week" ), Inc( 1 ), Minor Ticks( 0 ),
Label Row( Label Orientation( "Angled" ) )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
32,
Level Name( 0, "Span of Task", Item ID( "Mean(Start Date)..Mean(End Date)", 1 ) ),
Properties( 0, {Fill Color( 2 )}, Item ID( "Mean(Start Date)..Mean(End Date)", 1 ) )
)}
),
Dispatch( {}, "graph title", TextEditBox, {Set Text( "Gantt Chart" )} ),
Dispatch( {}, "X title", TextEditBox, {Set Text( "Date" )} ),
Dispatch( {}, "Y title", TextEditBox, {Set Text( "Tasks" )} )
)
);
// set axis values
offset = (Col Max( :end date ) - Col Min( :end date )) / 20;
gbr = gb << report;
gbr["Graph Builder", AxisBox( 1 )] << Min( Col Min( :start date ) - offset );
gbr["Graph Builder", AxisBox( 1 )] << Max( Col Max( :end date ) + offset );
// Add the display
gbr["Graph Builder", FrameBox( 1 )] << Add Graphics Script(
// Get Category values
Summarize( dt, catGroups = by( :Category ) );
For Each Row(
Fill Color( Contains( catGroups, :category ) + 2 );
Rect( :Start Date, Num( :unit ) - .9, :End Date, Num( :unit ) - 1.1, fill = 1 );
);
)
;
Re: 시간에 따라 카테고리가 변하는 타임라인 가로 막대 차트를 만듭니다.매우 감사합니다!귀하의 솔루션은 제가 찾던 것과 거의 정확합니다.각 기간마다 다른 색상 막대를 얻기 위해 데이터를 어떻게 조작했는지 완전히 이해할 수 없었습니다.다음은 스크립트의 2가지 질문입니다.
1. 카테고리별 범례를 어떻게 표시하나요?오른쪽 위에? - 표의 A,B,C,D,E 등의 값이 마음에 드시나요?각 유닛의 각 색상 막대 위 또는 내부에 표시할 수도 있나요?
2. 빨간색 막대 뒤에 흰색 직사각형 공간이 보입니다.그것들은 무엇이며 그래프에 표시할 수 없나요?
이를 더욱 개선하는 데 도움을 주셔서 감사합니다.정말 감사합니다!
Re: 시간에 따라 카테고리가 변하는 타임라인 가로 막대 차트를 만듭니다.JMP에는 원하는 것을 생성하는 차트가 내장되어 있지 않습니다.그러나 원하는 것을 얻기 위해 기본 그래프를 수정하는 기능이 있습니다.따라서 이전에 제공하고 더 많은 주석을 추가했으며 아래 나열된 JSL은 그래프 빌더 플랫폼을 사용하여 필요한 그래프에 대한 일반 형식을 생성하지만 스크립트는 여기에 그래픽을 추가하여 원하는 결과를 제공합니다. 원래 결과를 삭제합니다.첫 번째 스크립트 목록에서는 원래 GB에서 생성된 막대를 흰색으로 표시하도록 변경했습니다.그러나 원래 막대만 삭제하도록 변경했습니다.원래 막대는 차트 배경에 표시되는 것입니다.
Legend에 관해서는 생성이 필요합니다.당신은 그 도전을 받아들여야 합니다.먼저 현재 스크립트를 연구해야 합니다.레아
Names Default To Here( 1 );
dt = Current Data Table();
// The Graph Builder Platform currently does not have the capability to create the
// needed Gantt like chart. The main issue is that it does not apppear that Graph
// Builder can display more than one Range Bar on a given line. If more than one
// range is input, then Graph Builder averages the start values and then averages
// the end values, and creates a range bar with the averaged values.
// However, Graph Builder does create a display window with the correct Axes etc.
// So the JSL below runs the Graph Builder Platform, and then adds the Gantt like
// bars, and then finally, deletes the original bars that Graph Builder created.
gb = Graph Builder(
Size( 1121, 626 ),
Show Control Panel( 0 ),
Variables(
X( :Start Date ),
X( :End Date, Position( 1 ) ),
Y( :Unit )
),
Elements( Bar( X( 1 ), X( 2 ), Y, Legend( 32 ), Bar Style( "Range" ) ) ),
SendToReport(
Dispatch(
{},
"Start Date",
ScaleBox,
{Min( 3790824458.85 ), Max( 3734876513.055 ), Interval( "Week" ), Inc( 1 ), Minor Ticks( 0 ),
Label Row( Label Orientation( "Angled" ) )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
32,
Level Name( 0, "Span of Task", Item ID( "Mean(Start Date)..Mean(End Date)", 1 ) )
)}
),
Dispatch( {}, "graph title", TextEditBox, {Set Text( "Gantt Chart" )} ),
Dispatch( {}, "X title", TextEditBox, {Set Text( "Date" )} ),
Dispatch( {}, "Y title", TextEditBox, {Set Text( "Tasks" )} )
)
);
// set axis values of the graph to make sure the complete date range is displayed
// Set the min date displayed to the earliest date - 5% of the overall range
// Set the max date displayed to the latest date + 5% of the overall range
offset = (Col Max( :end date ) - Col Min( :end date )) / 20;
gbr = gb << report;
gbr["Graph Builder", AxisBox( 1 )] << Min( Col Min( :start date ) - offset );
gbr["Graph Builder", AxisBox( 1 )] << Max( Col Max( :end date ) + offset );
// Add the color bars to the display
gbr["Graph Builder", FrameBox( 1 )] << Add Graphics Script(
// Get Category values
Summarize( dt, catGroups = by( :Category ) );
// Loop through each row in the data table and draw a filled rectangle on the
// display
For Each Row(
Fill Color( Contains( catGroups, :category ) + 2 );
Rect( :Start Date, Num( :unit ) - .9, :End Date, Num( :unit ) - 1.1, fill = 1 );
);
);
// Delete the bars created by Graph Builder
theBarSeg = gbr["Graph Builder", FrameBox( 1 )] << find seg( bar seg);
theBarSeg << delete;
d 스크립팅 가이드를 읽고 스크립팅 색인을 숙지하세요.그러면 전설을 건설하는 일을 맡을 수 있습니다.