CursorCoordinateGraph cursorGraph = new CursorCoordinateGraph(); // setting new text mappings cursorGraph.XTextMapping = value => { if (Double.IsNaN(value)) return ""; DateTime time = dateAxis.ConvertFromDouble(value); return time.ToLongTimeString(); }; plotter.Children.Add(cursorGraph);
<c:ChartPlotter.HorizontalAxis> <c:HorizontalDateTimeAxis Name="dateAxis"/> </c:ChartPlotter.HorizontalAxis>
private EnumerableDataSource<StockInfo> CreateCurrencyDataSource(List<StockInfo> rates) { EnumerableDataSource<StockInfo> ds = new EnumerableDataSource<StockInfo>(rates);
ds.SetXMapping(ci => dateAxis.ConvertToDouble(ci.Date));
ds.SetYMapping(ci => ci.Rate);
return ds;
}
时间: 2024-11-10 09:41:48