I am trying to chart candlestick markers for a chart of stock prices. I have a marker for every minute of a trading day - 9:30 AM to 4:00 PM. I don't want to display empty space for 4:01 PM to 9:29 AM for each trading day. Is there a way I can remove that time span from my X axis on my graph? I want all the data to look continuous without break in flow. I am using a NumericAxis for my X axis with a TickToDateTimeLabelProvider that I created. Is there a way to change the LabelProvider to fit my needs? Or does it stretch deeper than that?
Here is my code for the LabelProvider:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
namespace Microsoft.Research.DynamicDataDisplay.Charts {
public class TickToDateTimeLabelProvider : NumericLabelProviderBase {
public override UIElement[] CreateLabels(ITicksInfo<double> ticksInfo) {
var res = new TextBlock[ticksInfo.Ticks.Length];
for (int i = 0; i < ticksInfo.Ticks.Length; ++i) {
long l = (long)ticksInfo.Ticks[i];
if (l < 0)
l = 0;
DateTime dt = new DateTime(l);
res[i] = new TextBlock();
res[i].Text = dt.ToString();
}
return res;
}
}
}