0
我在WPF中使用D3(动态数据显示)。我有代码来绘制一个动态线图这里是我的代码片段。如何在d3中绘制不同颜色的图形wpf
for (int counter = 0; counter < animatedX.Count; counter++)
{
Chart.Trade trade = new Chart.Trade(animatedX[counter], animatedY[counter]);
Color currentLineColor = Colors.Green;
if (previousCloseprice > animatedY[counter])
{
currentLineColor = Colors.Red;
}
Dispatcher.BeginInvoke(new Action(() =>
{
chartLine.LinePen = new Pen(new SolidColorBrush(currentLineColor), 3);
}));
_chartValue.AppendAsync(Dispatcher, trade);
Thread.Sleep(100);
}
从上面的代码我能够绘制单color.when previousCloseprice > animatedY[counter]
动画图形时,这种情况真就改变线的颜色,但它转换全线color.I想图表行应该是组合红色和绿色根据条件