When the data on the X-axis is blank, it will cause the chart to display blank
sunshinexyp opened this issue · comments
The data can not be blank, if you want to hide x-axis, you should set the options like this:
// custom option func
func(opt *charts.ChartOption) {
opt.XAxis.Show = charts.FalseFlag()
},
When there is only one data, the height of the label occupies the entire coordinate axis, and the display is not very beautiful. I want to set the height smaller, so I think of filling in 4 empty strings. Here, I use . to fill it, because it uses empty strings. The string will become blank, so that the adaptively generated height after this operation will meet the requirements. How to set the height of the label to be fixed when the amount of data is small? Or I want the filled axis data not to be displayed
The null
value is not supported. You can try using charts-rs,Web Demo Page: https://charts.npmtrend.com/ , the options:
{
"width": 600,
"height": 400,
"font_family": "Roboto",
"sub_title_text": "Sub Title",
"legend_align": "left",
"type": "horizontal_bar",
"title_text": "World Population",
"x_axis_data": [
"Brazil",
"Indonesia",
"USA",
"India",
"China",
""
],
"series_list": [
{
"name": "2011",
"label_show": true,
"data": [
18203,
23489,
29034,
104970,
131744,
null
]
},
{
"name": "2012",
"label_show": true,
"data": [
19325,
23438,
31000,
121594,
134141,
null
]
}
],
"series_label_formatter": "{t}",
"series_label_position": null,
"theme": "grafana"
}
Set the max value of y axis:
// custom option func
func(opt *charts.ChartOption) {
opt.YAxisOptions = []charts.YAxisOption{
{
Max: charts.NewFloatPoint(6.0),
},
}