2

各人のタスクを表示する積み上げ縦棒グラフを電子メールで送信するユーティリティを作成しています。現在、プロットをエクスポートするためPngExporterに inを使用しOxyPlot.WindowsFormsていますが、画像の下限を制御する方法がわかりません。ユーザー名は非常に長くなる可能性があり、外側にはみ出す可能性があります。下の軸の描画領域を拡張して、すべての名前が表示されるようにしたいと考えています。

これが今の様子です

プロット

そして、これが私がこれまでに持っているもののコードです

        var plot = new PlotModel()
        {
            Title = "Mantis Report"
        };

        // CATEGORY AXIS CODE====================================
        var categoryaxis = new CategoryAxis();
        foreach (var e in employees)
            categoryaxis.ActualLabels.Add(paddedString("Jebediah Kerman"));
        categoryaxis.Angle = 30;

        categoryaxis.AxisTickToLabelDistance = 10;
        // CATEGORY AXIS CODE====================================

        plot.Axes.Add(categoryaxis);
        plot.Axes.Add(new LinearAxis());

        var series = new ColumnSeries();
        series.IsStacked = true;

        int employeeindex = 0;
        foreach (var employee in employees)
        {
            foreach (var entry in employee.Tasks)
            {
                series.Items.Add(new ColumnItem(entry.Value, employeeindex) { Color = colors[entry.Key] });
            }
            employeeindex++;
        }

        plot.Series.Add(series);

        plot.LegendTitle = "legend";
        plot.LegendPlacement = LegendPlacement.Outside;
        foreach (string task in tasktypes)
        {
            var newseries = new ColumnSeries()
            {
                FillColor = colors[task]
                , Title = task
            };
            plot.Series.Add(newseries);
        }

paddedString()指定された文字列の長さを空白で先頭に追加して返します。これは、ラベルを「翻訳」するための現在のアプローチですが、現在、名前の残りの部分を描画することを心配しています.

ページを一通り見ましたCategoryAxisが、名前が完全に表示されるように軸領域を拡張する方法が見つからないようです。いいえ、ユーザー名を短くするだけではありません。

4

1 に答える 1

3

これは、WPF アプリケーションでうまくいきました。

var currentMargins = plotModel.PlotMargins;
plotModel.PlotMargins = new OxyThickness(currentMargins.Left, currentMargins.Top, currentMargins.Right, 100);
于 2014-08-27T14:09:20.813 に答える