« FileMaker 14 | Home | MBS FileMaker Plugin,… »

ChartDirector 6 PDF example

While working on ChartDirector 6 Plugin, we got this sample code for you:
// The data for the bar chart dim data(-1) as double = array(85.0, 156, 179.5, 211, 123) // The labels for the bar chart dim labels(-1) as string = array("Mon", "Tue", "Wed", "Thu", "Fri") // Create a XYChart object of size 250 x 250 pixels dim c as new CDXYChartMBS(250, 250) // Set the plotarea at (30, 20) and of size 200 x 200 pixels call c.setPlotArea(30, 20, 200, 200) // Add a bar chart layer using the given data call c.addBarLayer(data) // Set the labels on the x axis. call c.xAxis.setLabels labels Backdrop = c.makeChartPicture // Create PDF and write to disk dim PDFData as string = c.makeChart(c.kPDF) if PDFData.lenb > 0 then dim PDFFile as FolderItem = SpecialFolder.Desktop.Child("simplebar with pdf.pdf") dim PDFStream as BinaryStream = BinaryStream.Create(PDFFile, true) if PDFStream <> nil then PDFStream.Write PDFData PDFStream.Close pdffile.Launch(true) end if end if
As you see the only change you may need in your application is to request the chart as PDF. The MakeChart function takes a new constant kPDF for the new output type PDF.
You can download and check the PDF here: simplebarwithpdf.pdf
(this PDF was generated on Mac with 64-bit Xojo alpha and ChartDirector 6 final candidate)
13 05 15 - 13:50