高图设置yAxis标签的宽度

时间:2019-06-27 07:37:00

标签: javascript highcharts

是否可以设置标签宽度或其他选项,以便在更改标签值时图形不会移动/调整。

yAxis: {
        title: { text: '' },
        useHTML: true,
        labels: {
            formatter: function() {
                return '<div class="yAxisCustomLabel">' + moneySign + this.axis.defaultLabelFormatter.call({
                    axis: this.axis,
                    value: this.value
                }) + '</div>';
            }
        }
    }

我试图制作一个自定义类并添加样式,但是没有成功,也许是因为它是svg的一部分。

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以设置marginLeft以便为yAxis提供足够的空间。

以下是maginLeft:200;

<script src="https://code.highcharts.com/highcharts.js"></script>

<div id="container" style="height: 400px"></div>
[ContextMenu("JobSleep")]
public void JobSleep()
{
    Debug.LogFormat("[JobSleep.Execute] Thread Id {0}", Thread.CurrentThread.ManagedThreadId);

    SleepJob job = new SleepJob() { };
    SleepJob2 job2 = new SleepJob2() { };
    JobHandle jh = job.Schedule(100, 64);
    JobHandle jh2 = job2.Schedule(100, 64, jh);
    JobHandle.ScheduleBatchedJobs();

    StartCoroutine(WaitFor(jh2));
}

IEnumerator WaiFor(JobHandle job)
{
    yield return new WaitUntil(() => job.IsComplete);

    Debug.LogFormat("[JobSleep.Execute] job IsComplete");
}