Microsoft Developer Network > 포럼 홈 > Chart Controls for .NET Framework > How go I get the HTML for the chart image AREA map
질문하기질문하기
 

답변됨How go I get the HTML for the chart image AREA map

  • 2009년 7월 1일 수요일 오후 6:05bennyb 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    I am generating my chart dynamically using a separate file (httpHandler). Is there a way to get the HTML <area/> tag content that the image create when it is rendered im an ASPX page?

    chart.RenderType = RenderType.ImageMap;
    string result = chart.GetHtmlImageMap("trendmap");

    The solution above returns a blank <map/> tag shown below:

    <map name="trendmap">
        <area shape="rct" coords="0,0,0,0" alt=""/>
    </map>

    Is there any property I am missing?

    • 편집됨bennyb 2009년 7월 2일 목요일 오후 1:51
    • 편집됨bennyb 2009년 7월 2일 목요일 오후 1:50
    •  

답변

모든 응답

  • 2009년 7월 3일 금요일 오전 4:09DelianTMSFT, 중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    To get Chart.GetHtmlImageMap result you have to render the chart first.
    Call SaveImage(System.IO.Stream.Null) before Chart.GetHtmlImageMap.

    Delian
  • 2009년 9월 11일 금요일 오후 5:55Merita23 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hi

    I implemet this, but I cant' see the image

    Protected

     

    Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim chart1 As Chart = GetChart()
    chart1.RenderType = RenderType.ImageMap
    chart1.SaveImage(System.IO.Stream.Null)
    Dim map As String = chart1.GetHtmlImageMap("trendmap")
    End Sub

     

    Function GetChart() As Chart
    Dim Dates1 As Date = Today
    Dim mySelectQuery As String = "SELECT Dates,Line,Loan FROM XCHART_200907 where Fecha >='" & Dates1 & "' order by Fecha"
    Dim myConnection As New SqlConnection(myConnectionString)
    Dim myReader As SqlDataReader
    Dim myCommand As New SqlCommand(mySelectQuery, myConnection)

     

    Dim adapter As New SqlDataAdapter(mySelectQuery, myConnection)
    myConnection.Open()
    Dim ax() As DateTime, ay1, ay2, unidades

     

    ReDim ax(NumPuntos - 1)
    ReDim ay1(NumPuntos - 1)
    ReDim ay2(NumPuntos - 1)
    myReader = myCommand.ExecuteReader()

     

    While myReader.Readax(i) = myReader.GetValue(0)
    ay1(i) = myReader.GetValue(1)
    ay2(i) = myReader.GetValue(2)
    i = i + 1
    End While
    myReader.Close()

     

    Dim chart = New Chart()

    chart.IsMapEnabled =

    True
    chart.Width = 600
    chart.Height = 150
    chart.Series.Add("one")
    chart.Series.Add(
    "two")

    chart.Series(

    "one").Points.DataBindXY(ax, ay1)
    chart.Series(
    "two").Points.DataBindXY(ax, ay2)

    Return chart

     

    End Function