OxyPlot需要LinearAxis的保证金

时间:2017-12-04 11:13:47

标签: c# wpf charts styles oxyplot

我使用C#,wpf,OxyPolt。

jquery Using ranges in switch cases?

我需要标签的保证金"标题名称,m"。

function checkRange(raceNumber, n, m) {
    if (raceNumber >= n && raceNumber <= m) { return x; }
    else { return !raceNumber; }
}

function race() {
    var raceNumber = Math.floor((Math.random()*100)+1);
    switch (raceNumber) {
        case checkRange(raceNumber, 1,14):
            return "Ambrier";
            break;
        case checkRange(raceNumber, 15,28):
            return "Barbar";
            break;
        case checkRange(raceNumber, 29,42):
            return "Wechselbalg";
            break;
        case checkRange(raceNumber, 43,56):
            return "Oger";
            break;
        case checkRange(raceNumber, 57,70):
            return "Kobold";
            break;
         case checkRange(raceNumber, 71,76):
            return "Zwerg";
            break;
         case checkRange(raceNumber, 77,82):
            return "Elf";
            break;
         case checkRange(raceNumber, 83,88):
            return "Entführter Mensch";
            break;
         case checkRange(raceNumber, 89,94):
            return "Troll";
            break;
         case checkRange(raceNumber, 95,100):
            return "Untoter";
            break;
    }
}

1 个答案:

答案 0 :(得分:3)

您可以使用以下属性:AxisTitleDistance =&#34; 30&#34;

 <oxy:Plot>
        <oxy:Plot.Series>
            <oxy:LineSeries ItemsSource="{Binding DataVM}" 
                  StrokeThickness="2" DataFieldX="X" DataFieldY="Y"/>
        </oxy:Plot.Series>
        <oxy:Plot.Axes>
            <oxy:LinearAxis Position="Bottom" AxisTitleDistance="30" Title="Title name"/>
            <oxy:LinearAxis Position="Left" AxisTitleDistance="30"  Title="Title name, m"/>
        </oxy:Plot.Axes>
    </oxy:Plot>