bool SetChartLegend(LegendId tLegend, ChartLegend tArg)
tLegend. Chart legend moniker.
tArg. Chart settings that should be determined.
The SetChartLegend operation changes chart legend settings.
To execute the operation, in the tLegend field specify legend moniker and in the tArg field specify determined settings. The moniker can be created based on the moniker of opened object instance, which chart legend is worked with. The chart legend moniker is created based on the moniker of the repository object, which chart is worked with, following the rules:
Express report instance moniker!Chart!Legend. Express report chart legend (if express report contains one sheet).
Express report instance moniker!Sheets!Sheet key!Chart!Legend. Chart legend on the specified express report sheet (if express report contains several sheets).
Workbook instance moniker!Chart!Legend. Workbook chart legend (if workbook contains one sheet).
Workbook instance moniker!Sheets!Sheet key!Chart!Legend. Chart legend on the specified workbook sheet (if workbook contains several sheets).
Regular report instance moniker!Sheets!Sheet key!Objects!Chart identifier!Legend. Chart legend located on regular report sheet.
The operation results in the logical True if the settings were applied successfully.
Below is the example of changing settings of the chart legend located on regular report sheet. The request contains legend moniker and background border and fill parameters to be set. The response contains whether changes are applied successfully.
{
"SetChartLegend" :
{
"tLegend" :
{
"id" : "S1!M!S!P1!Sheets!1!Objects!PrxChart2!Legend"
},
"tArg" :
{
"bg" :
{
"type" : "2",
"gfill" :
{
"cf" : "#00FF00",
"ct" : "#009900",
"tp" : "50",
"a" : "45"
}
},
"bd" :
{
"enabled" : "true",
"clr" : "#999999",
"s" : "0",
"w" : "2"
}
}
}
}
{
"SetChartLegendResult" : "1"
}
public static bool SetChartLegend(string moniker)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tSet = new SetChartLegend()
{
tLegend = new LegendId()
{
id = moniker
},
tArg = new ChartLegend()
{
bg = new ChartBackgroundSettings()
{
type = 2,
gfill = new ChartGradientFillSettings()
{
cf = "#00FF00",
ct = "#009900",
tp = 50,
a = 45
}
},
bd = new ChartBorderSettings()
{
enabled = true,
s = 0,
clr = "#999999",
w = 2
}
}
};
// Change legend settings
var result = somClient.SetChartLegend(tSet);
return result;
}
See also: