SetChartResult SetChart(ChartId tChart, SetChartArg tArg)
tChart. Chart moniker.
tArg. Data change parameters.
The SetChart operation changes chart data.
To execute the operation, in the tChart parameter specify chart moniker, and in the tArg.meta parameter specify updated data and metadata. The chart moniker is based on moniker of the repository object, with the chart of which the user is working, following the rules:
"Express report instance moniker"!Chart. Express report chart (if the express report consists of a single sheet).
"Express report instance moniker"!Sheets!"Sheet key"!Chart. Chart of the selected express report sheet (if the express report consists of several sheets).
"Workbook instance moniker"!Chart. Workbook chart (if the workbook consists of a single sheet).
"Workbook instance moniker"!Sheets!"Sheet key"!Chart. Chart of the selected workbook sheet (if the workbook consists of several sheets).
"Regular report instance moniker"!"Sheet key"!Objects!"Chart identifier". Chart located on a regular report sheet.
Below is the example of using the SetChart operation to change express report chart. The request contains a chart instance and a pattern for data change. The response contains changed data.
{ "SetChart" : { "tChart" : { "id" : "S1!M!S!E1!Chart" }, "tArg" : { "meta" : {
"options" : "", "toolTipImageMap" : "Data by regions" }, "metaGet" : { "data" : "true", "hiChart" : "true" } } } }
{ "SetChartResult" : { "id" : {
"id" : "S1!M!S!E1!Chart" }, "metaGet" : { "md" : { "data" : { "Points" : {
"Point" : [ { "@Name" : "2000A1" }, { "@Name" : "2001A1" }, { "@Name" : "2002A1"
}, { "@Name" : "2003A1" }, { "@Name" : "2004A1" }, { "@Name" : "2005A1" }
] }, "series" : { "@Name" : "United States" }, "values" : { "value" : [
{ "@SerieIndex" : "0", "@value2" : "0.000000,0.000000,0.000000,0.000000,0.000000,0.000000", "$" : "1.383864,1.348390,1.348390,1.348390,1.433527,1.589612" } ] }, "IsEditable" : { "value" :
{ "@SerieIndex" : "0", "$" : "1,1,1,1,1,1" } }, "ToolTips" : { "ToolTip" : [ {
"@SP" : "0,0", "$" : "1,38" }, { "@SP" : "0,1", "$" : "1,35" }, { "@SP" : "0,2", "$" : "1,35"
}, { "@SP" : "0,3", "$" : "1,35" }, { "@SP" : "0,4", "$" : "1,43" }, {
"@SP" : "0,5", "$" : "1,59" } ] }, "Labels" : { "Label" : [ {
"@SP" : "0,0", "$" : "1,38" }, { "@SP" : "0,1", "$" : "1,35" }, { "@SP" : "0,2", "$" : "1,35"
}, { "@SP" : "0,3", "$" : "1,35" }, { "@SP" : "0,4", "$" : "1,43" }, {
"@SP" : "0,5", "$" : "1,59" } ] } } }, "hiChart" : "{"chart": {"areaBorderEnabled": false,"auto": false,"backgroundColor": "rgba(255, 255, 255, 1.000000)","borderColor": "#909090","borderRadius": 0,"borderWidth": 0.666663289070129,"chartAsImage": false,"defaultSeriesType": "column","displayVolume3D": false,"gapWidthCoef": 1.5,"inverted": false,"marginLeft": 80,"marginRight": 50,"overlapCoef": 0,"plotBackgroundColor": "rgba(230, 230, 230, 1.000000)","plotBorderColor": "rgba(128, 128, 128, 1.000000)","plotBorderEnabled": true,"plotBorderWidth": 0.944881916046143,"renderTo": "container","seriesOrder": "forward","stockStyle": "lowHighClose"},"legend": {"align": "center","backgroundColor": null,"borderColor": "#909090","borderEnabled": false,"borderWidth": 0.0881939977407455,"elementVerticalAlign": "middle","enabled": true,"itemStyle": {"color": "#000000","fontFamily": "Arial","fontSize": "7.086614pt","fontStyle": "normal","fontWeight": "normal","textDecoration": "none"},"layout": "horizontal","verticalAlign": "bottom"},"plotOptions": {"series": {"connectNulls": true,"dataLabels": {"color": "rgba(0, 0, 0, 1.000000)","customPosition": {"hotspotHorAlign": "center","hotspotPositionCoef": 0.5,"hotspotPositionOffsetX": 0,"hotspotPositionOffsetY": 0,"hotspotVertAlign": "center"},"enabled": false,"formatter": "%Autovalue","position": "custom","rotation": 0,"style": {"color": "#000000","fontFamily": "Arial","fontSize": "7.086614pt","fontStyle": "normal","fontWeight": "normal","textDecoration": "none"}},"marker": {"enabled": false},"stacking": null}},"series": [{"auto": true,"borderColor": "rgba(11, 26, 39, 0.501961)","borderPenEnabled": true,"borderWidth": 0.37795278429985,"brushEnabled": true,"canDrillDown": false,"canDrillUp": false,"color": "rgba(46, 106, 159, 1.000000)","dashStyle": "solid","data": [{"auto": true,"color": "rgba(46, 106, 159, 1.000000)","name": "2000A1","x": 0,"y": 1.38386357},{"auto": true,"color": "rgba(46, 106, 159, 1.000000)","name": "2001A1","x": 0,"y": 1.34838968},{"auto": true,"color": "rgba(46, 106, 159, 1.000000)","name": "2002A1","x": 0,"y": 1.34838968},{"auto": true,"color": "rgba(46, 106, 159, 1.000000)","name": "2003A1","x": 0,"y": 1.34838968},{"auto": true,"color": "rgba(46, 106, 159, 1.000000)","name": "2004A1","x": 0,"y": 1.43352691},{"auto": true,"color": "rgba(46, 106, 159, 1.000000)","name": "2005A1","x": 0,"y": 1.5896119}],"dataIndex": 0,"dataLabels": {"color": "rgba(0, 0, 0, 1.000000)","customPosition": {"hotspotHorAlign": "center","hotspotPositionCoef": 0.5,"hotspotPositionOffsetX": 0,"hotspotPositionOffsetY": 0,"hotspotVertAlign": "center"},"dataFormat": "0.00","enabled": true,"formatter": "%Autovalue","position": "custom","rotation": 0,"style": {"color": "#000000","fontFamily": "Arial","fontSize": "7.086614pt","fontStyle": "normal","fontWeight": "normal","textDecoration": "none"}},"displayStacked": false,"emptyDashStyle": "dot","emptyLineColor": "rgba(46, 106, 159, 1.000000)","emptyLinePenEnabled": false,"emptyLineWidth": 1.5118111371994,"is3DBorder": false,"legendIndex": 0,"lineColor": "rgba(46, 106, 159, 1.000000)","linePenEnabled": true,"lineWidth": 1.5118111371994,"marker": {"enabled": false},"name": "United States","shadow": false,"showInLegend": true,"trendLine": {},"visible": true,"zIndex": 1}],"title": {"align": "center","style": {"backgroundColor": null,"borderColor": "#909090","borderStyle": "none","borderWidth": 0,"color": "#000000","fontFamily": "Arial","fontSize": "14.173228pt","fontStyle": "normal","fontWeight": "bold","textDecoration": "none"},"text": ""},"tooltip": {"dataFormat": "0.00","enabled": true,"formatter": "%Autovalue"},"xAxis": {"axisXPlacement": "betweenticks","categories": ["2000A1","2001A1","2002A1","2003A1","2004A1","2005A1"],"gridLineColor": "#909090","gridLineDashStyle": "none","gridLineEnabled": false,"gridLineWidth": 0.666663289070129,"includeZero": false,"labels": {"enabled": true,"rotation": -90,"spacing": true,"style": {"color": "#000000","fontFamily": "Arial","fontSize": "7.086614pt","fontStyle": "normal","fontWeight": "normal","textDecoration": "none"}},"lineColor": "rgba(128, 128, 128, 1.000000)","lineEnabled": true,"lineWidth": 0.37795278429985,"minorGridLineColor": "rgba(255, 255, 255, 1.000000)","minorGridLineDashStyle": "none","minorGridLineEnabled": false,"minorGridLineWidth": 0.666663289070129,"opposite": false,"position": "auto","reversed": false,"showMarksForHiddenLabels": false,"step": 1,"stepAuto": true,"textIsStagger": false,"textIsStaggerOddFirst": true,"textMultiline": "bySymbols","tickColor": "rgba(128, 128, 128, 1.000000)","tickEnabled": true,"tickMarksInterval": 1,"tickWidth": 0.37795278429985,"tickmarkPlacement": "on","title": {"style": {"backgroundColor": null,"borderColor": "#909090","borderStyle": "none","borderWidth": 0,"color": "#000000","fontFamily": "Arial","fontSize": "9.921260pt","fontStyle": "normal","fontWeight": "bold","textDecoration": "none"},"text": ""},"visible": true},"yAxis": {"displayUnit": "none","gridLineColor": "rgba(128, 128, 128, 1.000000)","gridLineDashStyle": "solid","gridLineEnabled": true,"gridLineWidth": 0.944881916046143,"includeZero": false,"labels": {"dataFormat": "#,##0.00","enabled": true,"rotation": 0,"spacing": true,"style": {"color": "#000000","fontFamily": "Arial","fontSize": "7.086614pt","fontStyle": "normal","fontWeight": "normal","textDecoration": "none"}},"lineColor": "rgba(128, 128, 128, 1.000000)","lineEnabled": true,"lineWidth": 0.37795278429985,"max": null,"min": null,"minorGridLineColor": "rgba(255, 255, 255, 1.000000)","minorGridLineDashStyle": "none","minorGridLineEnabled": false,"minorGridLineWidth": 0.666663289070129,"opposite": false,"position": "auto","reversed": false,"tickColor": "rgba(128, 128, 128, 1.000000)","tickEnabled": true,"tickInterval": null,"tickWidth": 0.37795278429985,"title": {"style": {"backgroundColor": null,"borderColor": "#909090","borderStyle": "none","borderWidth": 0,"color": "#000000","fontFamily": "Arial","fontSize": "9.921260pt","fontStyle": "normal","fontWeight": "bold","textDecoration": "none"},"text": "Value"},"type": "linear","visible": true}}" } } }
The SetChart function changes express report chart and exports it to the JSON and XML formats. Input parameters:
eax. Opened express report instance.
After execution the function returns the changed chart.
public static SetChartResult SetChart(EaxId eax) { var somClient = new SomPortTypeClient(); // Proxy object for operation execution // Operation execution parameters var tSet = new SetChart() { tArg = new SetChartArg() { metaGet = new ChartMdPattern()
{ data = true, hiChart = true }, meta = new ChartMd() { options = "", toolTipImageMap = "Data by regions" } }
tChart = new ChartId() { id = eax.id + "!Chart" } }; // Change chart var result = somClient.SetChart(tSet); Console.WriteLine("Chart is changed: " + result.id.id); var chart = result.metaGet; // Export XML description of chart XmlDocument chartXml= new XmlDocument(); XmlElement el = chartXml.CreateElement(chart.md.Name); el.InnerXml = chart.md.InnerXml;
chartXml.AppendChild(el); chartXml.Save("C:\\ChartOutput.xml"); // Export JSON description of chart FileStream fs = new FileStream("C:\\ChartJsonOutput.json", FileMode.OpenOrCreate); Byte[] info = new UTF8Encoding(true).GetBytes(chart.hiChart); //Write data to file fs.Write(info, 0, info.Length); fs.Flush(); fs.Close(); return result; }
See also: