# Function toChartProps

toChartProps(widgetModel): ChartProps

Translates a WidgetModel to the props for rendering a chart.

# Parameters

Parameter Type
widgetModel WidgetModel

# Returns

ChartProps

# Example

<script setup lang="ts">
import { widgetModelTranslator, useGetWidgetModel, Chart } from '@sisense/sdk-ui-vue';
import { computed } from 'vue';

const { data: widgetModel } = useGetWidgetModel({
 dashboardOid: 'your-dashboard-oid',
 widgetOid: 'your-widget-oid',
});

const chartProps = computed(() =>
 widgetModel.value ? widgetModelTranslator.toChartProps(widgetModel.value) : null,
);
</script>

<template>
 <Chart
   v-if="chartProps"
   :chartType="chartProps.chartType"
   :dataSet="chartProps.dataSet"
   :dataOptions="chartProps.dataOptions"
   :filters="chartProps.filters"
   :highlights="chartProps.highlights"
   :styleOptions="chartProps.styleOptions"
 />
</template>

Note: this method is not supported for pivot widgets. Use toPivotTableProps instead for getting props for the PivotTable.