如何使用grails将JFreeChart渲染为gsp

时间:2012-07-05 11:11:21

标签: jfreechart grails-2.0

我是grails的新手。我无法将JFree Chart BAr图表呈现给我的gsp。相反,它被渲染为个人形象。我希望bboth我的gsp表单和图表在同一个gsp上呈现。请帮忙!!!!!!

1 个答案:

答案 0 :(得分:1)

def chart = ...

def buffer = chart.createBufferesImage( 700, 200 )
def bytes = EncoderUtil.encode( buffer, 'png' )

response.contentType = 'image/png'
response.contentLength = bytes.length
def out = response.outputStream
out.write( bytes )
out.flush()
out.close()

来自卡塔赫纳哥伦比亚!!!