2

I imagine this question will not bear anything, but this is a last ditch attempt before I have to tell my PM I simply can't do it.

My colleague (usefully before leaving the project) was a yes man to everything our PM asked for, regardless of what it was, and I seem to have been volunteered to create some functionality that will generate an Organogram / Organisational Chart and present it in the view.

I have dug around and asked around, no one really seems to know how I would go about doing this. Can anyone offer any advice on anything that can help? Even if it's the most basic tutorial or obscure API ever, it will be helpful.

To put a point on it, my question is: Is it possible to generate a chart in an ASP.NET MVC C# Application, and display it on a View? (Even a yes or no would help)

4

3 回答 3

0

您可以将图表绘制交给外部库,例如Google Visualization: Organizational Chart

看看这个问题以获取其他建议的库: 使用 JavaScript 绘制组织结构图的最佳库是什么?

于 2013-07-23T11:12:40.573 回答
0

这听起来像是在商业场景中,因此非常值得关注商业可用的解决方案。Steven 已经提到过一种,但据我所知,一种用于 Windows 窗体,另一种用于条形图中的图表,不提供组织图功能。

具有显示组织结构图功能的 Javascript 图表库是yFiles for HTML。它有一个很好的组织结构图在线示例,可能正是您正在寻找的:

组织结构图演示

还有一个视频展示了实际演示。

该库是一个纯 Javascript 实现,完全不依赖于服务器库或服务器。不过,只要您了解 Javascript,将它集成到 ASP.net 环境中应该很容易。作为一个库,它提供了完整的定制功能。您可以确定图表所有方面的外观和感觉。在底层,该库是一个通用的图形绘制和编辑工具,而组织结构图只是一个可能的用例。

全面披露:我为创建图书馆的公司工作,但我不代表我的雇主。我的评论、想法等都是我自己的。

于 2013-07-24T06:42:32.777 回答
0

是的,一切皆有可能。这只是你可以花多少时间在上面的问题。不过,并不是所有的东西都有很好的投资回报,但这要由你的 PM 来决定。只要您的团队能够对复杂性做出估计。

但是对于 ASP.NET,Microsoft 有一个图表库,可以让您构建图表。还有一些功能更丰富的商业图书馆(谷歌的第一个热门)。

如果它们不起作用,您始终可以使用System.Drawing.NET 的命名空间手动构建图像(这当然比使用可用库之一绘制图表要花费更多时间)。生成的图像可以通过 ashx 处理程序发送,或者您可以使用 base64 编码将图像嵌入到同一页面中

对你的 PM 说“是”还不错,但我宁愿说:“是的,我们会将这个特性放在特性列表/待办事项上,并估计复杂性。一旦我们知道复杂性,你就可以选择它为未来的迭代。” 但也许我现在说得太敏捷了 ;-)

于 2013-07-23T10:40:46.580 回答