Espacio de nombres: microsoft.graph
Actualizar las propiedades del objeto chartdatalabels.
Esta API está disponible en las siguientes implementaciones nacionales de nube.
| Servicio global |
Gobierno de EE. UU. L4 |
Us Government L5 (DOD) |
China operada por 21Vianet |
| ✅ |
✅ |
✅ |
❌ |
Permissions
Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use un permiso o permisos con privilegios superiores solo si la aplicación lo requiere. Para obtener más información sobre los permisos delegados y de aplicación, consulte Tipos de permisos. Para obtener más información sobre estos permisos, consulte la referencia de permisos.
| Tipo de permiso |
Permisos con privilegios mínimos |
Permisos con privilegios más altos |
| Delegado (cuenta profesional o educativa) |
Files.ReadWrite |
No disponible. |
| Delegado (cuenta personal de Microsoft) |
Files.ReadWrite |
No disponible. |
| Aplicación |
No admitida. |
No admitida. |
Solicitud HTTP
PATCH /me/drive/items/{id}/workbook/worksheets/{id|name}/charts/{name}/dataLabels
PATCH /me/drive/root:/{item-path}:/workbook/worksheets/{id|name}/charts/{name}/dataLabels
| Nombre |
Descripción |
| Authorization |
{token} de portador. Obligatorio. Obtenga más información sobre la autenticación y la autorización. |
| Content-Type |
application/json. Obligatorio. |
| Workbook-Session-Id |
Identificador de sesión de libro que determina si los cambios se conservan o no. Opcional. |
Cuerpo de solicitud
En el cuerpo de la solicitud, proporcione los valores de los campos relevantes que deben actualizarse. Las propiedades existentes que no se incluyan en el cuerpo de la solicitud mantendrán los valores anteriores o se recalcularán según los cambios efectuados en otros valores de propiedad. Para obtener el mejor rendimiento no debe incluir valores existentes que no hayan cambiado.
| Propiedad |
Tipo |
Descripción |
| position |
cadena |
Valor DataLabelPosition que representa la posición de la etiqueta de datos. Los valores posibles son: None, Center, , InsideEnd, OutsideEndInsideBase, , Left, Right, Top, Bottom, BestFit, Callout. |
| separator |
string |
Cadena que representa el separador empleado para las etiquetas de datos de un gráfico. |
| showBubbleSize |
Booleano |
Valor booleano que representa si el tamaño de la burbuja de la etiqueta de datos es visible o no. |
| showCategoryName |
Booleano |
Valor booleano que representa si el nombre de categoría de la etiqueta de datos es visible o no. |
| showLegendKey |
Booleano |
Valor booleano que representa si la clave de leyenda de la etiqueta de datos es visible o no. |
| showPercentage |
Booleano |
Valor booleano que representa si el porcentaje de la etiqueta de datos es visible o no. |
| showSeriesName |
Booleano |
Valor booleano que representa si el nombre de serie de la etiqueta de datos es visible o no. |
| showValue |
Booleano |
Valor booleano que representa si el valor de la etiqueta de datos es visible o no. |
Respuesta
Si se ejecuta correctamente, este método devuelve un 200 OK código de respuesta y un objeto workbookChartDataLabels actualizado en el cuerpo de la respuesta.
Ejemplo
Solicitud
En el ejemplo siguiente se muestra la solicitud.
PATCH https://graph.microsoft.com/v1.0/me/drive/items/{id}/workbook/worksheets/{id|name}/charts/{name}/dataLabels
Content-type: application/json
{
"position": "position-value",
"showValue": true,
"showSeriesName": true,
"showCategoryName": true,
"showLegendKey": true
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new WorkbookChartDataLabels
{
Position = "position-value",
ShowValue = true,
ShowSeriesName = true,
ShowCategoryName = true,
ShowLegendKey = true,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Drives["{drive-id}"].Items["{driveItem-id}"].Workbook.Worksheets["{workbookWorksheet-id}"].Charts["{workbookChart-id}"].DataLabels.PatchAsync(requestBody);
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewWorkbookChartDataLabels()
position := "position-value"
requestBody.SetPosition(&position)
showValue := true
requestBody.SetShowValue(&showValue)
showSeriesName := true
requestBody.SetShowSeriesName(&showSeriesName)
showCategoryName := true
requestBody.SetShowCategoryName(&showCategoryName)
showLegendKey := true
requestBody.SetShowLegendKey(&showLegendKey)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
dataLabels, err := graphClient.Drives().ByDriveId("drive-id").Items().ByDriveItemId("driveItem-id").Workbook().Worksheets().ByWorkbookWorksheetId("workbookWorksheet-id").Charts().ByWorkbookChartId("workbookChart-id").DataLabels().Patch(context.Background(), requestBody, nil)
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WorkbookChartDataLabels workbookChartDataLabels = new WorkbookChartDataLabels();
workbookChartDataLabels.setPosition("position-value");
workbookChartDataLabels.setShowValue(true);
workbookChartDataLabels.setShowSeriesName(true);
workbookChartDataLabels.setShowCategoryName(true);
workbookChartDataLabels.setShowLegendKey(true);
WorkbookChartDataLabels result = graphClient.drives().byDriveId("{drive-id}").items().byDriveItemId("{driveItem-id}").workbook().worksheets().byWorkbookWorksheetId("{workbookWorksheet-id}").charts().byWorkbookChartId("{workbookChart-id}").dataLabels().patch(workbookChartDataLabels);
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
const options = {
authProvider,
};
const client = Client.init(options);
const workbookChartDataLabels = {
position: 'position-value',
showValue: true,
showSeriesName: true,
showCategoryName: true,
showLegendKey: true
};
await client.api('/me/drive/items/{id}/workbook/worksheets/{id|name}/charts/{name}/dataLabels')
.update(workbookChartDataLabels);
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\WorkbookChartDataLabels;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WorkbookChartDataLabels();
$requestBody->setPosition('position-value');
$requestBody->setShowValue(true);
$requestBody->setShowSeriesName(true);
$requestBody->setShowCategoryName(true);
$requestBody->setShowLegendKey(true);
$result = $graphServiceClient->drives()->byDriveId('drive-id')->items()->byDriveItemId('driveItem-id')->workbook()->worksheets()->byWorkbookWorksheetId('workbookWorksheet-id')->charts()->byWorkbookChartId('workbookChart-id')->dataLabels()->patch($requestBody)->wait();
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.workbook_chart_data_labels import WorkbookChartDataLabels
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = WorkbookChartDataLabels(
position = "position-value",
show_value = True,
show_series_name = True,
show_category_name = True,
show_legend_key = True,
)
result = await graph_client.drives.by_drive_id('drive-id').items.by_drive_item_id('driveItem-id').workbook.worksheets.by_workbook_worksheet_id('workbookWorksheet-id').charts.by_workbook_chart_id('workbookChart-id').data_labels.patch(request_body)
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
Respuesta
En el ejemplo siguiente se muestra la respuesta. Nota: el objeto de respuesta que se muestra aquí puede haberse acortado para mejorar la legibilidad.
HTTP/1.1 200 OK
Content-type: application/json
{
"position": "position-value",
"showValue": true,
"showSeriesName": true,
"showCategoryName": true,
"showLegendKey": true
}