formatter
:
(
val
)
=>
{
let
c
=
document
.
createElement
(
"canvas"
)
;
const
ctx
=
c
.
getContext
(
"2d"
)
;
ctx
.
font
=
"16px normal"
;
const
arr
=
val
.
split
(
""
)
;
arr
.
map
(
(
item
)
=>
ctx
.
measureText
(
item
)
.
width
)
.
reduce
(
(
pre
,
next
,
index
)
=>
{
const
nLen
=
pre
+
next
;
if
(
nLen
>
200
)
{
arr
[
index
-
1
]
+=
"\n"
;
return
next
;
}
else
{
return
nLen
;
}
)
;
c
=
null
;
return
arr
.
join
(
""
)
;
-
通过
grid.left
和
yAxis.axisLabel.margin
来调整文字与左边界限和坐标轴的距离
grid: {
right: "3%",
left: -180,
bottom: 0,
containLabel: true
yAxis: [
axisLabel: {
align: "left",
margin: 200,
人生路漫漫,其实人生路上所经历的挫折磨难,换个角度想,也并非全是坏事,
纵然结果不尽人意,但至少还是能让我们从中领悟到什么,能成长些许,让我们阅历更加丰富。
面对失败,切勿消极秃废,遇到低谷,切勿怨天尤人,无论生活给予我们什么,无论每天的日子是快乐还是苦闷,都应微笑来迎接每一天,只要心态好,总能遇见美好,只要不消沉,总能找到出口。
生活中,所遭遇的磨难,其实也并非一无是处,它们教会我们坚强,教会我们更勇敢面对生活。教会我