Wiki Link: [discussion:5475]
Creating Tick Marks on Candlestick Charts 

Dec 13 2012 at 1:25 PM
Hi,

I would like to add "tick marks" to candlestick charts that I produce using MSChart (using C# and .Net 4.0). A tick mark is an additional label, surrounded by a coloured box, added to the y2-axis of a chart to show the latest value of an indicator (which is typically shown as another line/series on the chart, in addition to the price series).

I have tried adding (RectangleAnnotation) Annotations to the chart (rather than using Custom Labels), and then positioning these using the ValueToPosition method of a YAxis (invoked insisde a handler for the Paint event on the chart). However, I have run into a couple of problems.

I cannot determine a reliable way of placing the Annotations' left-hand side next the right hand side of the plot area (i.e. in-line with the left-hand side of the y2-axis). ChartArea has a Position property that has a Right property, but this gives the right-hand side of the y2-axis, not the plot area (the same property on the InnerPlotPosition property of the ChartArea has the same value).

The second issue I have (which I found out after investigating the above) is that we create these charts in a server process (which creates the charts and then mails then to recipients), and because of this (I did not get the same issue when I tested using a windows application) the Paint event on the chart does not seem to get invoked (we get the contents of the chart by saving it as a Bitmap).

If anyone has any ideas of how to solve the above, or a different approach (perhaps using Custom Labels), then they would be greatly received.

Many thanks,

Mat


Updating...
Page view tracker