분포(히스토그램) 플롯의 가로 축에 대한 레이블 방향과 형식(엔지니어링 SI)을 변경하려고 합니다. 작성 중인 표현식 내에서 디스패치 문을 사용하여 첫 번째 항목에 대해 이를 수행할 수 있지만 열 목록의 모든 히스토그램에 대해 이를 수행할 수 있어야 합니다.
다음의 "{}" 사이에 열 이름에 대한 다양한 유형의 호출을 삽입해 보았습니다.
Dispatch( {},
그러나 히스토그램이 변경되는 원인은 없습니다. 문자 그대로 열 이름(예: {"My Column"})만 입력하면 작동하지만 colList 배열의 모든 이름에 대해 그렇게 하려고 합니다.
dt = currentdatatable();
col = dt << get column names();
nc = N Items( col );
colList = {};
bin_width={};
For( i = 1, i <= nc, i++,
If(Contains (col[i],"::"),
Insert Into( colList, col[i] ))
);
For(i = 1, i <= N Items(colList), i++,
Insert Into(bin_width,0.0);
bin_width[i] = Col Max(Column(dt, colList[i])) - Col Min(Column(dt, colList[i]));
bin_width[i] = bin_width[i]/10;
);
theExpr = "dis = dt << Distribution(Stack( 1 ),
Continuous Distribution( column( column(dt,colList[1])), Set Bin Width(bin_width[1]), Label Row( Label Orientation( \!"Perpendicular\!" ) ))
";
For( i = 2, i < N Items( colList ), i++,
theExpr = theExpr || ", Continuous Distribution( column( column(dt, colList[" || Char( i ) || "])), Set Bin Width(bin_width[i]))"
);
theExpr = theExpr || ",
SendToReport(
Dispatch(
{},
\!"1\!",
ScaleBox,
{Format( \!"Engineering SI\!", 10 ), Minor Ticks( 0 ),
Label Row( Label Orientation( \!"Perpendicular\!" ) )}
)
);";
Eval( Parse( theExpr ) );내가 취할 접근 방식은 다음과 같습니다.
dt = currentdatatable();
col = dt << get column names();
nc = N Items( col );
colList = {};
bin_width={};
For( i = 1, i <= nc, i++,
If(Contains (col[i],"::"),
Insert Into( colList, col[i] ))
);
For(i = 1, i <= N Items(colList), i++,
Insert Into(bin_width,0.0);
bin_width[i] = Col Max(Column(dt, colList[i])) - Col Min(Column(dt, colList[i]));
bin_width[i] = bin_width[i]/10;
);
theExpr = "dis = dt << Distribution(Stack( 1 ),
Continuous Distribution( column( column(dt,colList[1])), Set Bin Width(bin_width[1]), Label Row( Label Orientation( \!"Perpendicular\!" ) ))
";
For( i = 1, i < N Items( colList ), i++,
theExpr = theExpr || ", Continuous Distribution( column( column(dt, colList[" || Char( i ) || "])), Set Bin Width(bin_width[i]))"
);
Eval( Parse( theExpr ) );
(dis << xpath("//AxisBox")) << format("Engineering SI", 10);
(dis << xpath("//AxisBox")) << Minor Ticks( 0 );
(dis << xpath("//AxisBox")) << Label Row( Label Orientation( "Perpendicular" ));