F# Make Bar Chart with Winforms DataVisualization

☆樱花仙子☆ 提交于 2019-12-12 17:24:19

问题


I want to make a bar Chart with Winforms and F#. I have seen many other C# examples making a chart with System.Windows.Forms.DataVisualization.Charting although when i try to open that library then it says then namespace is not defined.

Something as simple as this let chart = new Chart() doesn't work due to the namespace of the library not being defined i take it. Though I have seen people do this in C#. What is the correct way for F#?

Can someone be so kind to show me how to make a chart in F# and point me in the right direction of a bar Chart?


回答1:


You will need to reference the correct assembly then you can open the namespace (equivalent of C# using) like this:

open System.Windows.Forms.DataVisualization.Charting

However, before you go down this route, I would strongly recommend you use FSharp.Charting, which is a wrapper arround DataVisualization.Charting and much easier to work with in F#.

Here is a snippet using DataVisualization.Charting

Here is an example of using F# Charting



来源:https://stackoverflow.com/questions/41795086/f-make-bar-chart-with-winforms-datavisualization

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