<!DOCTYPE html>
<html lang="es" dir="ltr">
<head>
<base href="../../../../../">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Servicio SFDocuments.Chart</title>
<link rel="shortcut icon" href="media/navigation/favicon.ico">
<link type="text/css" href="normalize.css" rel="Stylesheet">
<link type="text/css" href="prism.css" rel="Stylesheet">
<link type="text/css" href="default.css" rel="Stylesheet">
<script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="es/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="es/bookmarks.js" defer></script><script type="text/javascript" src="es/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<header id="TopLeftHeader"><a class="symbol" href="es/text/shared/05/new_help.html"><div></div></a><a class="logo" href="es/text/shared/05/new_help.html"><p dir="auto">Ayuda de LibreOffice 25.2</p></a><div class="dropdowns"><div class="modules">
<button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Módulo</button><nav id="modules-nav" hidden=""></nav>
</div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contenido</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Buscar en los marcadores del módulo elegido" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div>
</div></div>
<div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication">
<noscript><div id="WarnJS"><h1 dir="auto">Active JavaScript en el navegador para mostrar las páginas de ayuda de LibreOffice.</h1></div></noscript>
<a id="ScriptForge-sf_chart"></a>
<a id="bm_id501600788076381"></a>
<meta itemprop="keywords" content="Chart service">
<a id="abstract"></a>
<h1 id="bm_id681600788076499" dir="auto">
<a id="ChartService"></a>Servicio <span class="literal">SFDocuments</span>.<span class="literal">Chart</span>
</h1>
<p id="par_id181600788076612" class="paragraph" dir="auto">The <span class="literal">Chart</span> service provides a set of properties and methods to handle charts in Calc documents. With this service it is possible to:</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id301600788076785" class="listitem" dir="auto">Acceder a los objetos de gráfico en los documentos de Calc y manipular sus propiedades.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id1001600788076848" class="listitem" dir="auto">Crear e insertar gráficos nuevos en un documento de Calc.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id67160078807676" class="listitem" dir="auto">Exportar los gráficos como archivos de imagen.</p>
</li>
</ul>
<h2 id="hd_id331635273472588" dir="auto">Nombres de gráfico</h2>
<p id="par_id251635273489315" class="paragraph" dir="auto">Los gráficos pueden tener dos nombres diferentes:</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id41635273536840" class="listitem" dir="auto">Un <span class="emph">nombre interno</span> que LibreOffice otorga en cuanto se crea el objeto del gráfico (normalmente «Objeto 1», «Objeto 2», y así sucesivamente).</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id641635273537122" class="listitem" dir="auto">Un <span class="emph">nombre personalizado</span> que puede definirse al pulsar con el botón secundario del ratón sobre el gráfico y eligiendo <span class="menuitem">Nombre</span> en el menú contextual.</p>
</li>
</ul>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id191635273980553" dir="auto">El servicio <span class="literal">Chart</span> utiliza principalmente el nombre definido por el usuario para acceder a un objeto de gráfico. Si no existe, se utiliza el nombre interno.</p></div>
</div>
<br>
<h2 id="hd_id281600788076359" dir="auto">Invocación del servicio</h2>
<p id="par_id141609955500101" class="paragraph" dir="auto">Antes de utilizar el servicio <span class="literal">Chart</span>, es necesario cargar o importar la biblioteca <span class="literal">ScriptForge</span>:</p>
<div class="embedded">
<a id="importLibs"></a>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id901528999850603" dir="auto">• Para cargar la biblioteca <span class="literal">ScriptForge</span> que necesitan las macros de Basic se debe usar la siguiente declaración:<br><span class="literal">GlobalScope.BasicLibraries.loadLibrary("ScriptForge")</span><br><br>• Los scripts de Python necesitan importar el módulo <span class="literal">scriptforge</span>:<br><span class="literal">from scriptforge import CreateScriptService</span></p></div>
</div>
<br>
</div>
<p id="par_id321614902851541" class="paragraph" dir="auto">The <span class="literal">Chart</span> service is instantiated from a <span class="literal">Calc</span> service instance either using the <span class="literal">Charts</span> or <span class="literal">CreateChart</span> methods.</p>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<p id="par_id531635274285114" class="paragraph" dir="auto">The example below creates a <span class="literal">Chart</span> service instance from an existing chart in the current Calc document:</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
Dim oDoc as Object, oChart as Object
Set oDoc = CreateScriptService("Calc")
Set oChart = oDoc.Charts("Sheet1", "Object 1")
</code></pre></div>
<p id="par_id851635274721129" class="paragraph" dir="auto">The following example instantiate the <span class="literal">Chart</span> service by creating a new chart object based on the data contained in the range "Sheet1.A1:C10".</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
Dim oDoc as Object, oChart as Object
Set oDoc = CreateScriptService("Calc")
Set oChart = oDoc.CreateChart("My Chart", "Sheet1", "Sheet1.A1:C10")
</code></pre></div>
<div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id881635275036852" dir="auto">Read the <a target="_top" href="es/text/sbasic/shared/03/sf_calc.html#CreateChart">CreateChart</a> method description to learn more about its arguments.</p></div>
</div>
<br>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<p id="par_id131635275172617" class="paragraph" dir="auto">Los ejemplos anteriores pueden escribirse en Python de esta manera:</p>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
from scriptforge import CreateScriptService
doc = CreateScriptService("Calc")
chart = doc.Charts("Sheet1", "Object 1")
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
doc = CreateScriptService("Calc")
chart = doc.CreateChart("My Chart", "Sheet1", "Sheet1.A1:C10")
</code></pre></div>
<a id="bm_id111614901524769"></a>
<meta itemprop="keywords" content="Chart service,ChartType">
<meta itemprop="keywords" content="Chart service,Deep">
<meta itemprop="keywords" content="Chart service,Dim3D">
<meta itemprop="keywords" content="Chart service,Exploded">
<meta itemprop="keywords" content="Chart service,Filled">
<meta itemprop="keywords" content="Chart service,Legend">
<meta itemprop="keywords" content="Chart service,Percent">
<meta itemprop="keywords" content="Chart service,Stacked">
<meta itemprop="keywords" content="Chart service,Title">
<meta itemprop="keywords" content="Chart service,XTitle">
<meta itemprop="keywords" content="Chart service,YTitle">
<meta itemprop="keywords" content="Chart service,XChartObj">
<meta itemprop="keywords" content="Chart service,XDiagram">
<meta itemprop="keywords" content="Chart service,XShape">
<meta itemprop="keywords" content="Chart service,XTableChart">
<h2 id="hd_id711600788076834" dir="auto">Propiedades</h2>
<a id="properties_toc"></a>
<table border="1" class="" cellpadding="0" cellspacing="0">
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id461600788076917" class="tableheadintable" dir="auto">Nombre</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id221600788076591" class="tableheadintable" dir="auto">De solo lectura</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id761600788076328" class="tableheadintable" dir="auto">Tipo</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id67160078807636" class="tableheadintable" dir="auto">Descripción</p>
</th>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id491600788076621" class="tablecontentintable" dir="auto">ChartType</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id311600788076756" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id831600788076785" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id441600788076826" class="tablecontentintable" dir="auto">Specifies the chart type as a string that can assume one of the following values: "Pie", "Bar", "Donut", "Column", "Area", "Line", "XY", "Bubble", "Net".</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id941600788076595" class="tablecontentintable" dir="auto">Deep</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id49160078807654" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id961600788076376" class="tablecontentintable" dir="auto">Boolean</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id81600788076419" class="tablecontentintable" dir="auto">When <span class="literal">True</span> indicates that the chart is three-dimensional and each series is arranged in the z-direction.</p>
<p id="par_id471635276257118" class="tablecontentintable" dir="auto">When <span class="literal">False</span> series are arranged considering only two dimensions.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id721600788076638" class="tablecontentintable" dir="auto">Dim3D</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id711600788076534" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id911600788076842" class="tablecontentintable" dir="auto">Boolean or String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id541600788076645" class="tablecontentintable" dir="auto">Specifies if the chart is displayed with 3D elements. If the value is a string, it must be either "Bar", "Cylinder", "Cone" or "Pyramid".</p>
<p id="par_id541600788076141" class="tablecontentintable" dir="auto">If the boolean <span class="literal">True</span> value is specified, then the chart is displayed using 3D bars.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id961600788076890" class="tablecontentintable" dir="auto">Exploded</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id891600788076190" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id761600788076562" class="tablecontentintable" dir="auto">Numeric</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id91600788076674" class="tablecontentintable" dir="auto">Specifies how much pie segments are offset from the chart center as a percentage of the radius. Applicable to pie and donut charts only.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id831633021719135" class="tablecontentintable" dir="auto">Filled</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id561633021747903" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id201633021748455" class="tablecontentintable" dir="auto">Boolean</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id831633021749007" class="tablecontentintable" dir="auto">When <span class="literal">True</span>, specifies a filled net chart. Applicable to net charts only.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id951600788076443" class="tablecontentintable" dir="auto">Legend</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id391600788076253" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id381600788076799" class="tablecontentintable" dir="auto">Boolean</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id21600788076541" class="tablecontentintable" dir="auto">Specifies whether or not the chart has a legend.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id41600788076936" class="tablecontentintable" dir="auto">Percent</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id211600788076138" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id221600788076518" class="tablecontentintable" dir="auto">Boolean</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id521600788076371" class="tablecontentintable" dir="auto">When <span class="literal">True</span>, chart series are stacked and each category sums up to 100%. Applicable to Area, Bar, Bubble, Column and Net charts.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id161600788076362" class="tablecontentintable" dir="auto">Stacked</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id21600788076758" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id871600788076196" class="tablecontentintable" dir="auto">Boolean</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id781600788076694" class="tablecontentintable" dir="auto">When <span class="literal">True</span>, chart series are stacked. Applicable to Area, Bar, Bubble, Column and Net charts.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id471600788076885" class="tablecontentintable" dir="auto">Title</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id261600788076841" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id661600788076636" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id11600788076757" class="tablecontentintable" dir="auto">Especifica el título principal del gráfico.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id221600789141781" class="tablecontentintable" dir="auto">XTitle</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id531600789141795" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id561600789141282" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id301600789141619" class="tablecontentintable" dir="auto">Especifica el título del eje X.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id821600789286339" class="tablecontentintable" dir="auto">YTitle</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id541600789286532" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id181600789286889" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id701600789286280" class="tablecontentintable" dir="auto">Especifica el título del eje Y.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id31600789752717" class="tablecontentintable" dir="auto">XChartObj</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id941608709527698" class="tablecontentintable" dir="auto">Sí</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id100100678952791" class="tablecontentintable" dir="auto">Objeto UNO</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id661300789527859" class="tablecontentintable" dir="auto">Returns the object representing the chart, which is an instance of the <a target="_blank" href="https://docs.libreoffice.org/sc/html/classScChartObj.html"><span class="literal">ScChartObj</span></a> class.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id31600789527717" class="tablecontentintable" dir="auto">XDiagram</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id941600789527698" class="tablecontentintable" dir="auto">Sí</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id100160078952791" class="tablecontentintable" dir="auto">Objeto UNO</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id631600789527859" class="tablecontentintable" dir="auto">Returns the <a target="_blank" href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1chart_1_1XDiagram.html"><span class="literal">com.sun.star.chart.XDiagram</span></a> object representing the diagram of the chart.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id31600789527123" class="tablecontentintable" dir="auto">XShape</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id941600789527099" class="tablecontentintable" dir="auto">Sí</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id100160078953251" class="tablecontentintable" dir="auto">Objeto UNO</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id631600789522587" class="tablecontentintable" dir="auto">Returns the <a target="_blank" href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1drawing_1_1XShape.html"><span class="literal">com.sun.star.drawing.XShape</span></a> object representing the shape of the chart.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id31600789527332" class="tablecontentintable" dir="auto">XTableChart</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id941600789527208" class="tablecontentintable" dir="auto">Sí</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id100160078952007" class="tablecontentintable" dir="auto">Objeto UNO</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id631600789527364" class="tablecontentintable" dir="auto">Returns the <a target="_blank" href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1table_1_1XTableChart.html"><span class="literal">com.sun.star.table.XTableChart</span></a> object representing the data being displayed in the chart.</p>
</td>
</tr>
</table>
<br>
<h2 id="hd_id581635335807782" dir="auto">Crear un gráfico</h2>
<p id="par_id231635335826090" class="paragraph" dir="auto">Considere los siguientes datos en el intervalo «A1:B6» de una hoja llamada «Informe».</p>
<table border="1" class="" cellpadding="0" cellspacing="0">
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id901635335950545" class="tableheadintable" dir="auto"></p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id111635335950545" class="tableheadintable" dir="auto">A</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id651635335950545" class="tableheadintable" dir="auto">B</p>
</th>
</tr>
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id591635335950822" class="tableheadintable" dir="auto">1</p>
</th>
<td rowspan="" colspan="" dir="auto">
<p id="par_id401635335950901" class="tablecontentintable" dir="auto">Sample A</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id151635335950965" class="tablecontentintable" dir="auto">Sample B</p>
</td>
</tr>
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id591635335958021" class="tableheadintable" dir="auto">2</p>
</th>
<td rowspan="" colspan="" dir="auto">
<p id="par_id401635335950888" class="tablecontentintable" dir="auto">36</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id151635335950047" class="tablecontentintable" dir="auto">40</p>
</td>
</tr>
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id591635335956841" class="tableheadintable" dir="auto">3</p>
</th>
<td rowspan="" colspan="" dir="auto">
<p id="par_id401635335950126" class="tablecontentintable" dir="auto">39</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id151635335933645" class="tablecontentintable" dir="auto">43</p>
</td>
</tr>
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id591635335959875" class="tableheadintable" dir="auto">4</p>
</th>
<td rowspan="" colspan="" dir="auto">
<p id="par_id401635335950008" class="tablecontentintable" dir="auto">45</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id151635335950367" class="tablecontentintable" dir="auto">40</p>
</td>
</tr>
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id591635335950287" class="tableheadintable" dir="auto">5</p>
</th>
<td rowspan="" colspan="" dir="auto">
<p id="par_id401635335951225" class="tablecontentintable" dir="auto">52</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id151635335950255" class="tablecontentintable" dir="auto">48</p>
</td>
</tr>
</table>
<br>
<p id="par_id911635336313498" class="paragraph" dir="auto">The examples below in Basic and Python show how to create a line chart from this data with legends.</p>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
oDoc = CreateScriptService("Calc")
oChart = oDoc.CreateChart("Samples", "Report", "Report.A1:B6")
oChart.ChartType = "Line"
oChart.Legend = True
oChart.Resize(1000, 1000, 25000, 15000)
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
doc = CreateScriptService("Calc")
chart = doc.CreateChart("Samples", "Report", "Report.A1:B6")
chart.ChartType = "Line"
chart.Legend = True
chart.Resize(1000, 1000, 25000, 15000)
</code></pre></div>
<div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id931635338174647" dir="auto">The chart does not need to be created in the same sheet where the data is located. It can be created in any existing sheet in the current file by specifying the sheet name in the second argument of the <span class="literal">CreateChart</span> method.</p></div>
</div>
<br>
<h2 id="hd_id501582887473754" dir="auto">Métodos</h2>
<a id="methods_toc"></a>
<table border="1" class="" cellpadding="0" cellspacing="0">
<tr>
<th rowspan="" colspan="2" class="tableheadcell" dir="auto">
<p id="par_id891611613601554" class="tableheadintable" dir="auto">Lista de métodos en el servicio Chart</p>
</th>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id891611613601556" class="tablecontentintable" dir="auto">
<a target="_top" href="es/text/sbasic/shared/03/sf_chart.html#ExportToFile">ExportToFile</a><br>
</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id541611613601554" class="tablecontentintable" dir="auto">
<a target="_top" href="es/text/sbasic/shared/03/sf_chart.html#Resize">Resize</a><br>
</p>
</td>
</tr>
</table>
<br>
<a id="ExportToFile"></a>
<a id="bm_id92158919969883"></a>
<meta itemprop="keywords" content="Chart service,ExportToFile">
<h2 id="hd_id201589199698251" dir="auto">ExportToFile</h2>
<p id="par_id93158919969864" class="paragraph" dir="auto">Saves the chart as an image file in a specified location. Returns <span class="literal">True</span> if the image file could be successfully created.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id821621534014732" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">chart.ExportToFile(filename: str, imagetype: str = "png", overwrite: bool = False): bool</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id821591631203996" class="paragraph" dir="auto"><span class="emph">filename</span>: Identifies the path and file name where the image will be saved. It must follow the notation defined in <span class="literal">SF_FileSystem.FileNaming</span>.</p>
<p id="par_id821591631203116" class="paragraph" dir="auto"><span class="emph">imagetype</span>: The name of the image type to be created. The following values are accepted: "gif", "jpeg", "png" (default), "svg" and "tiff".</p>
<p id="par_id821591631203133" class="paragraph" dir="auto"><span class="emph">overwrite</span>: Specifies if the destination file can be overwritten (Default = <span class="literal">False</span>).</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
oChart.ExportToFile("C:\Temp\myChart.svg", ImageType := "svg", Overwrite := True)
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
chart.ExportToFile(r"C:\Temp\myChart.svg", imagetype="svg", overwrite=True)
</code></pre></div>
<a id="Resize"></a>
<a id="bm_id92158919969883"></a>
<meta itemprop="keywords" content="Chart service,Resize">
<h2 id="hd_id201589199698887" dir="auto">Resize</h2>
<p id="par_id93158919969165" class="paragraph" dir="auto">Changes the position of the chart in the current sheet and modifies its width and height. Returns <span class="literal">True</span> if resizing was successful.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id821621534025532" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">chart.Resize([xpos: int], [ypos: int], [width: int], [height: int]): bool</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id821591631200626" class="paragraph" dir="auto"><span class="emph">xpos, ypos:</span> Specify the new X and Y positions of the chart. If any of these values are omitted or if negative values are provided, the corresponding positions are left unchanged.</p>
<p id="par_id821591631204288" class="paragraph" dir="auto"><span class="emph">width:</span> Specify the new width of the chart. If this argument is omitted or if a negative value is provided, the chart width is left unchanged.</p>
<p id="par_id821591631203208" class="paragraph" dir="auto"><span class="emph">height:</span> Specify the new height of the chart. If this argument is omitted or if a negative value is provided, the chart height is left unchanged.</p>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id301635340527472" dir="auto">All arguments are provided as integer values that correspond to 1/100 of a millimeter.</p></div>
</div>
<br>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Changes only X and Y position
oChart.Rezise(1000, 3000)
' Cambia solo la anchura y la altura del gráfico
oChart.Resize(, , 25000, 12500)
' Keyword arguments are supported
oChart.Resize(Width := 25000, Height := 12500)
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
chart.Rezise(1000, 3000)
chart.Resize(-1, -1, 20000, 20000)
chart.Resize(width=25000, height=12500)
</code></pre></div>
<div class="embedded">
<a id="SF_InternalUse"></a>
<div class="warning">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/warning.svg" alt="warning" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id851506659675843" dir="auto">Todas las rutinas o identificadores BASIC de <span class="literal">ScriptForge</span> precedidas por guion bajo «_» están reservadas para uso interno. No deben utilizarse en macros BASIC o secuencias Python.</p></div>
</div>
<br>
</div>
<a id="relatedtopics"></a><div class="relatedtopics">
<p class="related" itemprop="mentions" dir="auto"><a id="related"></a><span class="emph">Temas relacionados</span></p>
<div class="relatedbody" itemprop="mentions">
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/shared/03/sf_calc.html"><span class="literal">SFDocuments</span>.<span class="literal">Calc</span> service</a></p></div>
</div>
</div>
</div>
<div id="DonationFrame"></div>
<footer><h2 style="text-align: center;"><a href="https://books.libreoffice.org" target="_blank">Libros de LibreOffice</a></h2>
<div class="noteicon" dir="auto" style="display:flex;justify-content:center;flex-wrap:wrap;row-gap:15px;">
<img src="media/navigation/libo-writer.svg" alt="Writer Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-calc.svg" alt="Calc Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-impress.svg" alt="Impress Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-draw.svg" alt="Draw Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-base.svg" alt="Base Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-math.svg" alt="Math Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-symbol-black.svg" alt="Getting Started Icon" style="width:60px;height:60px;">
</div>
<div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/sbasic/shared/03/sf_chart.xhp" target="_blank">/text/sbasic/shared/03/sf_chart.xhp</a></p>
<p dir="auto">Title is: Servicio SFDocuments.Chart</p>
<p id="bm_module" dir="auto"></p>
<p id="bm_system" dir="auto"></p>
<p id="bm_HID" dir="auto"></p>
</div></footer>
</body>
</html>