public static XAxisLabel NewAxisLabel(string label, double xoffsetPct, int yoffsetPixels, LabelPreferences xlp) { return(new XAxisLabel() { Text = label, Foreground = xlp.Foreground, Background = xlp.Background, FontFamily = xlp.Font, FontSize = xlp.Fontsize, FontStyle = xlp.Style, FontWeight = xlp.Weight, RenderTransform = new ScaleTransform(1, -1, 0.5, 0.5), XOffsetPct = xoffsetPct, YOffsetPixels = yoffsetPixels }); }
public static YAxisLabel NewAxisLabel(string label, double yoffsetPct, int xoffsetPixels, LabelPreferences ylp) { YAxisLabel yal = new YAxisLabel() { Text = label, Foreground = ylp.Foreground, Background = ylp.Background, FontFamily = ylp.Font, FontSize = ylp.Fontsize, FontStyle = ylp.Style, FontWeight = ylp.Weight, YOffsetPct = yoffsetPct, XOffsetPixels = xoffsetPixels }; ScaleTransform st = new ScaleTransform(1, -1, 0.5, 0.5); TransformGroup tg = new TransformGroup(); tg.Children.Add(st); if (ylp.Orientation == LabelOrientations.VerticalBottomToTop) { yal.RenderTransformOrigin = new System.Windows.Point(1, 1); tg.Children.Add(new RotateTransform(90)); } if (ylp.Orientation == LabelOrientations.VerticalTopToBottom) { tg.Children.Add(new RotateTransform(-90)); } yal.RenderTransform = tg; return(yal); }