我正在尝试在LiveCharts库中创建动态图。目前,我需要能够将值映射到时间戳,因为我绘制的值是具有特定名称的传感器值,获取值的时间戳以及值本身,但是该库似乎只能将double
值作为x值。我希望能够将此设置为字符串,并将每个点映射到特定的时间戳。
我为此尝试了几种不同的方法,包括使用不同类型的点(可观察点,GSeries点等)手动将x轴标签设置为时间戳,但似乎没有一个具有此功能。
目前,我正在这样绘制图形:
private static void CreateNewPlot(Dictionary<string, List<double>> headersAndValues, List<string> timeLables)
{
PlotWindow window = new PlotWindow();
SeriesCollection graph = new SeriesCollection();
foreach (KeyValuePair<string, List<double>> temp in headersAndValues)
{
graph.Add(new GLineSeries
{
Title=temp.Key,
Values = temp.Value.AsGearedValues()
});
}
window.ChartContainer.Series = graph;
//window.GSeriesValues = graph;
window.Show()
有什么我想念的吗?是否存在一种将点明确分配给double
以外的值的方法?