in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

How to render C1ChartImage by manual mode

Last post 06-23-2008 5:41 PM by C1_AndrewM. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-11-2008 9:14 AM

    How to render C1ChartImage by manual mode

    Hello,

      Please let me know how to render C1ChartImage by manual mode.We are using httphandler method for image rendering.The performance of image rendered by httphandler is not as expected. We would like to boost the performance of image rendering process.How to do render C1chartimage by manual

     

    Filed under:
  • 06-23-2008 5:41 PM In reply to

    Re: How to render C1ChartImage by manual mode

    Hello Gopivishwanath,
     

    Please know that you can refer to the Tutorial below to generate the chart image using ASPPage ImageRenderMethod and can use either Session, cache and file as the ImageTransferMethod.

     

    The ASP Page-based tutorials show how you can replace the built-in HttpHandler with custom ASP pages, thereby gaining extra control over the chart rendering mechanism. This method allows you to customize, for example, the behavior of the client and server caches, and IIS logging.

    Both tutorials use the following ASP page to replace the HttpHandler mechanism, and differ only in the way they store the chart data. The code below can handle both Session and Cache transfers. It performs the exact same functions as the built-in HttpHandler, and should be useful as a starting point for your custom pages.

    ·      Visual Basic

    Imports System

    Imports System.Web

    Imports System.Web.SessionState

    Namespace AspPageSample
    _

    Public Class StreamResponse

    Inherits System.Web.UI.Page

     Private Sub Page_Load(sender As Object, e As System.EventArgs)

      ' Determine how the image is transferred to this page

      Dim ses As String = Request("SessionID")   ' non null if session transfer

      Dim cac As String = Request("CacheID")     ' non null if cache transfer

      Dim del As String = Request("Delete")      ' non null if delete request

      Dim doDelete As Boolean = False

      

      ' Check the delete request status

      If Not (del Is Nothing) Then

       del = del.ToLower()

       doDelete = del = "t" Or del = "true"

      End If

      

      Dim image As Byte() = Nothing

      Dim imgtype As String = String.Empty

      Dim img As String = String.Empty

      Dim hsh As String = String.Empty

      

      If Not (ses Is Nothing) Then

       ' extract the image info from the session object

       img = ses + "_ImageBytes"

       hsh = ses + "_Hash"

       

       image = CType(Session(img), Byte())

       imgtype = CStr(Session(hsh))

       

       If doDelete Then

        Session.Remove(img)

        Session.Remove(hsh)

       End If

      Else

       If Not (cac Is Nothing) Then

        ' extract the image info from the Application cache

        img = cac + "_ImageBytes"

        hsh = cac + "_Hash"

        

        image = CType(Cache(img), Byte())

        imgtype = CStr(Cache(hsh))

        

        If doDelete Then

         Cache.Remove(img)

         Cache.Remove(hsh)

        End If

       End If

      End If

      If Not (image Is Nothing) And Not (imgtype Is Nothing) Then

       ' return the binary image to the client

       imgtype = "image/" + imgtype.Substring((imgtype.LastIndexOf("."c) + 1))

       Response.Clear()

       Response.Cache.SetExpires(DateTime.MinValue)  ' clear client cache

       Response.ContentType = imgtype

       Response.BinaryWrite(image)

       Response.Flush()

      End If

     End Sub

    End Class

    End Namespace

    <Gopivishwanath Saravanan> wrote in message news:205793@10.0.1.98...

    Hello,

      Please let me know how to render C1ChartImage by manual mode.We are using httphandler method for image rendering.The performance of image rendered by httphandler is not as expected. We would like to boost the performance of image rendering process.How to do render C1chartimage by manual

     



    http://helpcentral.componentone.com/cs/forums/p/75520/205793.aspx#205793

Page 1 of 1 (2 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.