| Id: | 12434 |
| Product: | finPOWER Connect |
| Type: | NEW |
| Version: | 2.02.03 |
| Opened: | 18/11/2014 |
| Closed: | 18/11/2014 |
| Released: | 04/12/2014 |
| Job: | J014496 |
Charts; Chart data can now be saved to a base-64 encoded String
Charts can be generated by Scripts that have access to the User Interface layer, e.g., Page Sets and HTML Report type Scripts.
Charts can be saved to a file using the UserIntefaceBL.ChartSaveToFilePng method. Generally, a temporary file name would be generated and the chart saved to this file.
A new method, UserIntefaceBL.ChartToPngBase64String has been added. Instead of saving the chart to a file, the chart's image data will be returned as a base-64 encoded String.
This String can be used as a data URL within an HTML page (supported fully by Internet Explorer 9 and above) meaning that not temporary file needs to be generated to view a chart.
The following code sample assumes a Page Set with a Button Page Object (cmdTest) and an HTML Panel Page Object (wbChart):
Public Sub cmdTest_Click(sender As Object, e As finPageObjectClickEventArgs) Handles cmdTest.ClickDim ChartData As StringDim ChartDetails As ISChartDetailsDim ChartSeries As ISChartSeries' InitialiseChartDetails = finBL.CreateChartDetails()' GeneralWith ChartDetails.ChartType = iseChartType.PieChart.Title = "Test Pie Chart"End With' Create SeriesChartSeries = chartdetails.Series.CreateSeries()With ChartDetails.Series(0)With .DataItems.AddValue(50, "Half").AddValue(25, "Quarter").AddValue(25, "Another Quarter")End WithEnd With' Get Chart Data as Base-64 String and view in HTML PanelIf mUI.ChartToPngBase64String(chartDetails, ChartData, 1280, 960) Then' ViewwbChart.Text = "<img src='data:image/png;base64," & ChartData & "' style='border:4px solid silver;'/>"ElsemUI.ErrorMessageShow()End IfEnd Sub