0
我使用HighCharts .NET API创建一个简单的图表:如何格式化轴highchart
Dim sFontFamily As String = "fontFamily: 'inherit'"
Dim oChart As DotNet.Highcharts.Highcharts = New DotNet.Highcharts.Highcharts("SearchCount")
With oChart
.InitChart(New DotNet.Highcharts.Options.Chart With {.Style = sFontFamily, .Height = 250, .DefaultSeriesType = DotNet.Highcharts.Enums.ChartTypes.Line})
.SetOptions(New GlobalOptions With {.Global = New DotNet.Highcharts.Options.Global With {.UseUTC = False}})
.SetTitle(New Title With {.Style = sFontFamily, .Text = "Search Count"})
.SetXAxis(New XAxis With {.Labels = New XAxisLabels With {.Style = sFontFamily}, .Title = New XAxisTitle With {.Style = sFontFamily, .Text = "Month"}})
.SetYAxis(New YAxis With {.Labels = New XAxisLabels With {.Style = sFontFamily}, .Title = New YAxisTitle With {.Style = sFontFamily, .Text = "Searches"}})
.SetCredits(New Credits With {.Enabled = False})
.SetTooltip(New Tooltip With {.Style = sFontFamily})
.SetSeries(New Series() With {.Name = "this year", .Data = New Data(oData)})
'display a legend so user knows what graphs represent
.SetLegend(New Legend With {.Style = sFontFamily, .Enabled = True})
litHighChartSearchCount.Text = oChart.ToHtmlString()
End With
为了方便这里的渲染结果:https://jsfiddle.net/d063mhoL/
而且数据传递给系列的外观像这样:
如果检查小提琴,你会看到在Y轴上的数据是数字,当我想它成为月份名称的字符串,任何人都可以帮忙吗?
更好是使用Y轴的日期时间类型,然后为每个点的时间戳(时间
list(of string)
毫秒)并通过http://api.highcharts.com/highcharts#yAxis.dateTimeLabelFormats格式化标签 –