procedure calc_m_b(x_data_1, x_data_2, x_plot_1, x_plot_2: real; var m, b: real);
m := (x_plot_2 - x_plot_1) / (x_data_2 - x_data_1);
b := (x_data_1 * x_plot_2 - x_data_2 * x_plot_1) / (x_data_1 - x_data_2);
where:
x_data_1 and x_data_2 are the start and end of the data range
x_plot_1 and x_plot_2 are the corresponding start and end on the plot
m and b are the slope and intercept of the resulting conversion line
The results are used thus:
x_plot = x_data * m + b
where x_plot is the plot value and xd is the data value