我希望用时间戳填充多个背景颜色的c#图表。
有没有人知道要执行此操作的任何代码,或者可能是实现等效代码的方法。
我考虑添加具有适当宽度的半透明列,但这看起来有点混乱。
任何见解和想法都将受到赞赏。
答案 0 :(得分:1)
如果您使用mschart
使用计时器
每个tick事件,将back color
设为color you want
答案 1 :(得分:0)
这可能对您有用
foreach (Series charts in chart1.Series) { foreach (DataPoint point in charts.Points) { if (point.AxisLabel == LibereStr) { point.Color = Color.Green; point.Font = new Font("Trebuchet MS", 9, FontStyle.Bold); if (Libere == 0) { point.IsEmpty = true; } } else if (point.AxisLabel == OccupateStr) { point.Color = Color.Red; point.Font = new Font("Trebuchet MS", 9, FontStyle.Bold); if (Occupate == 0) { point.IsEmpty = true; } } else if (point.AxisLabel == PrenotateStr) { point.Color = Color.Violet; point.Font = new Font("Trebuchet MS", 9, FontStyle.Bold); if (Prenotate == 0) { point.IsEmpty = true; } } point.Label = string.Format("{0:0} - {1}", point.YValues[0], point.AxisLabel); } }