[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-31 (世界標準時間)。"],[],[],null,["# Using visualization components and the dashboard property to render a simple visualization\n\nUsing the [`dashboard` property](/looker/docs/components-vis-prop-tables#dashboard_prop) of the [`Query` visualization component](/looker/docs/components-vis-prop-tables#query) allows you to render an embeddable visualization that can respond to changes to the Looker UI. Using the `dashboard` property offers the following benefits:\n\n- The visualization can be updated by any Looker user with edit access to the dashboard.\n- Updates to the embedded visualization don't require any changes to your deployed extension or React application.\n\nTo render an embeddable visualization using Looker visualization components and a numeric dashboard ID, make sure your setup [meets the requirements](#requirements), and then perform the following steps:\n\n1. [Build a query and add it to a dashboard](#step_1:_build_a_query_and_add_it_to_a_dashboard).\n2. [Embed the query into a React application using the dashboard ID](#step_2:_embed_the_query_into_a_react_application_using_the_dashboard_id).\n3. [Modify the visualization if necessary](#step_3:_modify_the_visualization_if_necessary).\n\nRequirements\n------------\n\nBefore you start, a few elements are needed:\n\n- You must have access to a Looker instance.\n- Whether you're building in the extension framework or your own stand-alone React application, it is important to authenticate with Looker's API and have access to the Looker SDK object. Read about [Looker API authentication](/looker/docs/api-auth) or our [extension framework](/looker/docs/intro-to-extension-framework) for more information.\n- Make sure you have installed the Looker Visualization Components [NPM package](https://www.npmjs.com/package/@looker/visualizations) and the `@looker/components-data` [NPM package](https://www.npmjs.com/package/@looker/components-data). Information on installing and using the visualization components package can be found in the README document, available in [GitHub](https://github.com/looker-open-source/components/tree/main/packages/visualizations) and [NPM](https://www.npmjs.com/package/@looker/visualizations).\n\nStep 1: Build a query and add it to a dashboard\n-----------------------------------------------\n\nUse an [Explore](/looker/docs/creating-and-editing-explores) to build a query within the Looker UI. Add a [supported](/looker/docs/components-vis#vis-components-supported-charts) visualization to the Explore and, optionally, configure its settings in the visualization's **Settings** menu.\n\n[Create a new dashboard](/looker/docs/creating-user-defined-dashboards#creating_a_dashboard_from_a_look_or_an_explore) using this query. Alternatively, you can [add the query](/looker/docs/creating-user-defined-dashboards#adding_query_tiles_from_an_explore) to a blank dashboard that [you have already created](/looker/docs/creating-user-defined-dashboards#creating_a_dashboard_from_a_folder).\n\nThe `Query` component will always load the visualization from the first tile that was added chronologically to the associated dashboard, regardless of where the tile appears in the dashboard layout. For this reason it is good practice to use only single-tile dashboards as the query reference.\n\nThe `Query` component will only display the tile visualization. It will not display the tile title, dashboard title, or other dashboard elements. Any dashboard filters applied to the tile will have no effect on the embedded visualization.\n\nOnce your dashboard is created, view the dashboard.\n\nA numeric dashboard ID appears in the dashboard URL after `dashboards/`. Copy this ID for use in the next step.\n\n\u003e The [`dashboard` property](/looker/docs/components-vis-prop-tables#dashboard_prop) of the `Query` component accepts only numeric IDs. It does not accept the string IDs of [LookML dashboards](/looker/docs/building-lookml-dashboards).\n\nStep 2: Embed the query into a React application using the dashboard ID\n-----------------------------------------------------------------------\n\nNow, you can embed the query into your React application by passing the dashboard ID in the [`dashboard` property](/looker/docs/components-vis-prop-tables#dashboard_prop) of the `Query` component: \n\n import React, { useContext } from 'react'\n import { ExtensionContext } from '@looker/extension-sdk-react'\n import { DataProvider } from '@looker/components-data'\n import { Query, Visualization } from '@looker/visualizations'\n\n export const MyReactApp = () =\u003e {\n const { core40SDK } = useContext(ExtensionContext)\n\n export const MyReactApp = ({ sdk: core40SDK }: Props) =\u003e {\n return (\n \u003cDataProvider sdk={core40SDK}\u003e\n \u003cQuery dashboard={61}\u003e\n \u003cVisualization /\u003e\n \u003c/Query\u003e\n \u003c/DataProvider\u003e\n )\n }\n\nStep 3: Modify the visualization if necessary\n---------------------------------------------\n\nNow, any Looker users with edit access to the dashboard are free to make changes to the visualization embedded within your dashboard, and the changes will appear within your React application without requiring any changes to the code.\n\nFor edit access, users must have the [**Manage Access, Edit** access level](/looker/docs/organizing-spaces#folder_access_levels) for the folder the dashboard is in, [model access](/looker/docs/admin-panel-users-roles#model_sets) to the model the query is based on, and the appropriate [Looker permissions](/looker/docs/admin-panel-users-roles#permissions_list) to edit dashboards.\n\nThere are two ways to modify the embedded visualization:\n\n- Edit the query tile on the dashboard, or\n- Add a new query tile to the dashboard and delete the original tile.\n\nTo edit the query tile, follow the instructions for [editing tiles](/looker/docs/editing-user-defined-dashboards#editing_tiles) on the [Editing user-defined dashboards](/looker/docs/editing-user-defined-dashboards) documentation page, and save your changes to exit edit mode on the dashboard.\n\nTo add a new tile and delete the original one, follow the instructions for [adding query tiles](/looker/docs/creating-user-defined-dashboards#adding_query_tiles_from_an_explore) to add your new tile. Then follow the instructions for [deleting tiles](/looker/docs/editing-user-defined-dashboards#deleting_a_tile) to delete the unwanted visualization. For your changes to apply, make sure there is only one tile on your dashboard, and then save your changes to exit edit mode on the dashboard.\n\nOnce you modify and save your dashboard, the visualization changes will appear in your extension or React application without requiring any changes to the code.\n\nNext steps\n----------\n\n- [Using visualization components to render custom visualizations](/looker/docs/components-vis-render-custom-vis)\n- [Using visualization components to build a custom visualization](/looker/docs/components-vis-custom)\n- [Visualization and Query property tables](/looker/docs/components-vis-prop-tables)"]]