Hi JoD,
Checking the overlapped point within the current plot may be a reasonable design. (Imagine a situation
such that you add a plot, then ALL data labels of current plots may have to repositioned...)
Though checking is static, the following script may help you...
//////////////////////////////////////////////////////////////
//Run this script on a graph without data labels
//
if(exist(%H)!=3) { type -b Active window is not a graph.; Return; }
gname$=%H; //Graph name
nout=0; //Total #data points
window -t wks; //Make a worksheet
worksheet -a 1; //Add a col to have c3 columns
range rrx=col(1), rry=col(2), rrL=col(3); //Range of rach column
window -ch 1; //Hide the worksheet
window -a %(gname$); //Reactivate the graph
doc -e DY { //Loop over each plot in the graph
range rpy=%C; //Y dataset of the plot
dataset rpx=xof(rpy); //X dataset of the plot
string colname$ = "";
getn (Label Column for %C is:) colname$:@BBColumn (Choose Label Column); //Select label dataset
range rpL=%(colname$); //Label dataset
nrpy=rpy.getSize(); //# of rows of the plot
for(jj=1; jj<=nrpy; jj++) { //Loop over plot dataset
nout++; //Index of the point
rry[nout]=rpy[jj]; //Y coordinate of the point
rrx[nout]=rpx[jj]; //X coordinate of the point
rrL[nout]$=rpL[jj]$; //Label of the point
}
}
layer -i201 rry; //Add a scatter plot to the graph
set rry -z 0; //Make the scatter invisible (symbol size 0)
set rry -q 1; //Set the data label ON
set rry -qm 8; //Label dataset is col(C)
//
//You should turn ON "Auto Reposition to Avoid Overlapping" manually.
//////////////////////////////////////////////////////////////
First create a graph without labels, and once you run this script, it creates an invisible scatter plot
with all data points in a temporary worksheet. At this moment, as it seems LabTalk cannot control the
"Auto Reposition to Avoid Overlapping" property, after running this you have to turn on this option
manually by yourself for the generated hidden scatter plot. You should be able to see the labels in effect.
You can modify this whatsoever you need.
--Hideo Fujii
OriginLab