Secondary Axis Fusion Chart vb.net的最大值

时间:2015-01-15 04:34:32

标签: vb.net graph charts

我有两个数据集。一个表示为2D 100%stcked列,另一个表示为line。 2D列位于主Y轴和&折线图位于辅助Y轴上。主Y轴和次Y轴最大值不匹配。这导致线图在不正确的位置wrt到列图。

例如:列图的值为[(60,40),(70,30)]。线图具有值[30,40]。所以这里的折线图显得高于柱状图。

    Sub createWeeklyGraph_stack()
    'Create an XML data document in a string variable

    Dim strXML As String = ""
    strXML = strXML & "<chart caption='Weekly Order Booking Efficiency' xaxisName='YearMonths' pyaxisname='Orders booked in percentage' syaxisname='I2 Confirmed without Amendment' showplotborder='1' palette='2' showborder='0'>"

    For i As Integer = 0 To ds_week.Rows.Count - 1
        Dim weekno1 As String = ds_week.Rows(i).Item(0).ToString()
        Dim mon1 As String = ds_week.Rows(i).Item(1).ToString()
        Dim Confirmedbyi21 As String = ds_week.Rows(i).Item(3).ToString()
        Dim Confirmedbypass1 As String = ds_week.Rows(i).Item(4).ToString()
        Dim Amended1 As String = ds_week.Rows(i).Item(5).ToString()
        Dim Amended_n1 As String = ds_week.Rows(i).Item(6).ToString()
    Next

    strXML = strXML & "<categories>"
    For i As Integer = 0 To ds_week.Rows.Count - 1
        strXML = strXML & "<category label='" & ds_week.Rows(i).Item(0).ToString & "'/>"
    Next
    strXML = strXML & "</categories>"

    strXML = strXML & "<dataset seriesName='I2' color='FFFF00'>"
    For i As Integer = 0 To ds_week.Rows.Count - 1
        strXML = strXML & "<set value= '" & ds_week.Rows(i).Item(3).ToString & "'/>"
    Next
    strXML = strXML & "</dataset>"

    strXML = strXML & "<dataset seriesName='Amend' color='FF0000'>"
    For i As Integer = 0 To ds_week.Rows.Count - 1
        strXML = strXML & "<set value= '" & ds_week.Rows(i).Item(5).ToString & "'/>"
    Next
    strXML = strXML & "</dataset>"

    strXML = strXML & "<dataset seriesName='Bypass' color='9ACCF6'>"
    For i As Integer = 0 To ds_week.Rows.Count - 1
        strXML = strXML & "<set value= '" & ds_week.Rows(i).Item(4).ToString & "'/>"
    Next
    strXML = strXML & "</dataset>"

    strXML = strXML & "<dataset seriesname='I2 Confirmed without Amendment' parentyaxis='S' linethickness='4' showvalues='0' renderas='Line' color='4B0082'>"
    For i As Integer = 0 To ds_week.Rows.Count - 1
        strXML = strXML & "<set value= '" & ds_week.Rows(i).Item(6).ToString & "'/>"
    Next

    strXML = strXML & "</dataset>"
    strXML = strXML & " <styles> "
    strXML = strXML & "<definition>"
    strXML = strXML & "<style type='font' name='CaptionFont' bold='1' color='666666' size='17' />"
    strXML = strXML & "<style type='font' name='SubCaptionFont' bold='1' />"
    strXML = strXML & "</definition>"
    strXML = strXML & "<application>"
    strXML = strXML & " <apply toObject='caption' styles='CaptionFont' />"
    strXML = strXML & " <apply toObject='SubCaption' styles='SubCaptionFont' />"
    strXML = strXML & "</application>"
    strXML = strXML & "</styles></chart>"

    'Create the chart - Stacked Column 3D Chart with data from strXML variable using dataXML method
    Dim str As String = FusionCharts.RenderChartHTML("FusionCharts1\StackedColumn3DLineDY.swf", "", strXML, "New1", "1200", "300", False)

    Literal1.Text = str
    Literal1.Visible = True
End Sub

我想做的就是使次要Y轴最大值为100或在次轴上定义间隔。这样两个Y轴就可以相互同步了。

1 个答案:

答案 0 :(得分:0)

添加以下语法有帮助。并且做了魔术。

 PYAxisMaxValue='110' SYAxisMaxValue='110' syncAxisLimits='1' 

完整图表起始线

strXML = strXML & "<chart caption='Order Booking Efficiency' xaxisName='YearMonths' pyaxisname='Orders booked in percentage' syaxisname='Amendment NonSystem in percentage' PYAxisMaxValue='110' SYAxisMaxValue='110' syncAxisLimits='1' showplotborder='1' palette='2' showborder='0' >"

Reference to the document