从子对象返回chartdirector图像

时间:2012-08-02 19:29:38

标签: asp.net .net vb.net charts

您好我正在尝试使用chartdirector和vb.net创建图表 我正在尝试做的是创建一个sub,将图像作为对象类返回,然后将从sub返回的内容追加到我页面中的图像标记

这是我到目前为止所做的:

   Private Sub createChart(ByVal sender As System.Object, ByVal e As 
    _System.EventArgs)
    Dim cd As Integer = CreateObject("ChartDirector.API")
    Dim chart As XYChart = New XYChart(700, 170)
    Dim values As Double() = {25, 18, 15, 12, 8, 30, 35}
    Dim labels As String() = {"Labor", "Licenses", "Taxes", "Legal", 
    "Insurance", "Facilities", "Production"}
    chart.setPlotArea(30, 20, 200, 200)
    chart.addBarLayer(values)
    chart.xAxis().setLabels(labels)
    HttpContext.Current.Response.ContentType = "image/png"
    Dim mina As BinaryWriter = chart.makeChart2()
    HttpContext.Current.Response.End()

End Sub

此行的代码中断

 Dim mina As BinaryWriter = chart.makeChart2()

出现以下错误Argument not specified for parameter format of public overridable function makechart2(format as integer ) As Byte()

任何想法如何解决这个问题都会很棒 谢谢

1 个答案:

答案 0 :(得分:0)

根据错误,makeChart2需要一个整数参数,它看起来像是返回Byte的数组,而不是BinaryWriter

我不熟悉chartdirector,所以我不知道是否有替代方案,或者您是否需要重构代码,但如果是后者,则需要新增BinaryWriterWritemakeChart2返回的值。