SetChartLegend

Syntax

bool SetChartLegend(LegendId tLegend, ChartLegend tArg)

Parameters

tLegend. Chart legend moniker.

tArg. Chart settings that should be determined.

Description

The SetChartLegend operation changes chart legend settings.

Comments

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:

The operation results in the logical True if the settings were applied successfully.

Example

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.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetChartLegend xmlns="http://www.fsight.ru/PP.SOM.Som">
<tLegend xmlns="">
  <id>S1!M!S!P1!Sheets!1!Objects!PrxChart2!Legend</id>
  </tLegend>
<tArg xmlns="">
<bg>
  <type>2</type>
<gfill>
  <cf>#00FF00</cf>
  <ct>#009900</ct>
  <tp>50</tp>
  <a>45</a>
  </gfill>
  </bg>
<bd>
  <enabled>true</enabled>
  <clr>#999999</clr>
  <s>0</s>
  <w>2</w>
  </bd>
  </tArg>
  </SetChartLegend>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
  <SetChartLegendResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">1</SetChartLegendResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"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"
}
}
}
}

JSON response:

{
"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:

Chart