Saturday, February 25, 2012

Charts

I have a Custom Dundas Charting library that I utilize normally. I'm having
troubles getting my chart object (and tried to return and image) to render
within my reports. I'm confident I have the custom assemblie referenced. I
don't want to use the chart field from the toolbox, I want to set it to what
my assemblie returns. Anyway to get around this? I'm aware of the custom
data extensions, although, I wanted to just have my existing assemblie which
returns charts do it instead. so all my reports that need graphs can just
reference the assemblie and graph that is needed. Anyway to accomplish this?
I'm getting data type reference errors etc.
ClintPlease try this:
* Add an image to your report
* Set the image type to Database
* Set the image mimetype to e.g. image/png
* For the image value use an expression like
=MyCustomAssembly.GenerateChart()
Note: your custom assembly call has to return the image as byte[].
Here is a code snippet which should convert the Dundas chart output into a
byte array:
public static byte[] GenerateChart()
{
// chart rendering code
...
// save chart image to byte[]
System.IO.MemoryStream renderedImage = new MemoryStream();
dundasChart.ImageType = ChartImageType.Png;
dundasChart.Save(renderedImage);
renderedImage.Position = 0;
return renderedImage.ToArray();
}
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Clint Jennings" <cjennings@.fusionAlliance.com> wrote in message
news:%237PwafckEHA.896@.TK2MSFTNGP12.phx.gbl...
> I have a Custom Dundas Charting library that I utilize normally. I'm
having
> troubles getting my chart object (and tried to return and image) to render
> within my reports. I'm confident I have the custom assemblie referenced.
I
> don't want to use the chart field from the toolbox, I want to set it to
what
> my assemblie returns. Anyway to get around this? I'm aware of the custom
> data extensions, although, I wanted to just have my existing assemblie
which
> returns charts do it instead. so all my reports that need graphs can just
> reference the assemblie and graph that is needed. Anyway to accomplish
this?
> I'm getting data type reference errors etc.
> Clint
>|||Thanks Robert. Created a public function in the library to return a byte
stream.
"Robert Bruckner [MSFT]" wrote:
> Please try this:
> * Add an image to your report
> * Set the image type to Database
> * Set the image mimetype to e.g. image/png
> * For the image value use an expression like
> =MyCustomAssembly.GenerateChart()
> Note: your custom assembly call has to return the image as byte[].
> Here is a code snippet which should convert the Dundas chart output into a
> byte array:
> public static byte[] GenerateChart()
> {
> // chart rendering code
> ...
> // save chart image to byte[]
> System.IO.MemoryStream renderedImage = new MemoryStream();
> dundasChart.ImageType = ChartImageType.Png;
> dundasChart.Save(renderedImage);
> renderedImage.Position = 0;
> return renderedImage.ToArray();
> }
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Clint Jennings" <cjennings@.fusionAlliance.com> wrote in message
> news:%237PwafckEHA.896@.TK2MSFTNGP12.phx.gbl...
> > I have a Custom Dundas Charting library that I utilize normally. I'm
> having
> > troubles getting my chart object (and tried to return and image) to render
> > within my reports. I'm confident I have the custom assemblie referenced.
> I
> > don't want to use the chart field from the toolbox, I want to set it to
> what
> > my assemblie returns. Anyway to get around this? I'm aware of the custom
> > data extensions, although, I wanted to just have my existing assemblie
> which
> > returns charts do it instead. so all my reports that need graphs can just
> > reference the assemblie and graph that is needed. Anyway to accomplish
> this?
> > I'm getting data type reference errors etc.
> >
> > Clint
> >
> >
>
>

No comments:

Post a Comment