How to draw candle charts in C#

一个人想着一个人 提交于 2019-12-23 07:47:14

问题


How can I draw candle charts in C#? Does anybody has any examples with a nice interface?


回答1:


I've used the MSChart and found it to be pretty good. It supports candlestick charts. I've used ZedGraph as well but found a few graphical anomalies showed up on my charts but they were otherwise good as well.




回答2:


I use this for stock data but its in VB

        With Chart1.ChartAreas("myarea")
            .AxisY.Maximum = (Math.Ceiling((HighValue * 100)) / 100)
            .AxisY.Minimum = (Math.Floor((LowValue * 100)) / 100)
            .AxisY.LabelStyle.Format = "{0.00}"
        End With

        Dim s1 As New Series
        With s1
            .ChartArea = "myarea"
            .ChartType = SeriesChartType.Candlestick
            .XValueType = ChartValueType.String
            .YValueType = ChartValueType.Single
            .YValuesPerPoint = 4
            .CustomProperties = "PriceDownColor=Red, PriceUpColor=Green"
        End With


        For i = Globals.GraphColumns - 1 To 0 Step -1
            OutData = Data_Array.Item(i)

            s1.Points.AddXY(OutData.thedate, OutData.high, OutData.low, OutData.close, OutData.open)


        Next


        Chart1.Series.Add(s1)
        Me.Controls.Add(Chart1)



回答3:


I'm using the .netCharting library for this and it's pretty good. It supports all sorts of charts - candle included. One thing to watch out for is that with the current version (5.3) you have to reverse the high and low price - a pretty ugly and obvious bug. It's a commercial product, but reasonably priced, so could be worth it, depending on your project.




回答4:


ZedGraph is a very easy-to-use LGPLed charting library that can handle candlestick charts.

If you need to save an image to disk, it can do that. If you need to display an interactive graph that supports zooming/panning, it can do that as well with the excellent ZedGraphControl control.




回答5:


Maybe ChartDirector can be a good solution

http://www.advsofteng.com/doc/cdcomdoc/candlestick.htm




回答6:


Try xamChart Control Trial version from Infragistics.

Here is another sample at CodeProject



来源:https://stackoverflow.com/questions/2650119/how-to-draw-candle-charts-in-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!