Here, "h" is being constructed as a Line array, with all the lines set to color [0 0 1], which is blue. Since you are making the legend passing "h" and "titles" as arguments, the legend results with a set of blue lines.
This can be resolved by setting the line color in "h" to the patch color within the for-loop, as shown in the following modified code snippet:
PR1 = boxplot(dataset, titles);
set(gca, 'xtick', );
h = findobj(gca,'Tag','Box');
CM = hsv(54);
x = patch(get(h(j),'XData'),get(h(j),'YData'), CM(j,:),'FaceAlpha',.5);
h(length(h)-j+1).Color = x.FaceColor;
legend(h, titles, 'location', 'Westoutside')
Please let me know if this fixed the issue.