페이지의 DOM 요소에 대한 핸들입니다. API가 이 요소에 툴바를 그립니다. 표준 시각화의 컨테이너 매개변수와 유사합니다.
툴바를 사용하는 시각화 옆에 툴바를 배치해야 합니다.
구성요소
객체의 배열로, 각각 데이터 또는 시각화를 내보낼 수 있는 형식을 설명합니다. 툴바는 배열에 추가된 순서대로 사용자에게 옵션을 노출합니다. 각 객체에는 형식을 설명하는 유형 속성과 유형에 따라 하나 이상의 추가 속성이 있습니다.
type: 'csv' - 이 옵션은 데이터를 쉼표로 구분된 값 파일로 내보냅니다. 브라우저에 '다른 이름으로 저장' 대화상자가 열립니다.
데이터 소스: 'string' - 데이터 소스 URL입니다.
type: html' - 이 옵션은 데이터를 HTML 테이블로 내보냅니다.
데이터 표가 있는 페이지가 브라우저의 새 창에서 열립니다.
데이터 소스: 데이터 소스 URL 문자열입니다.
type: igoogle - 이 옵션을 사용하면 사용자가 시각화를 자신의 iframe 페이지에 추가할 수 있습니다. 브라우저에 'iGoogle에 추가' 페이지가 열립니다. 가젯 버전에서 시각화를 사용할 수 있는 경우에만 사용하세요.
데이터 소스: 데이터 소스 URL 문자열입니다.
gadget: 가젯화된 버전의 xml URL 문자열입니다. 툴바와 연결된 시각화는 가젯화된 버전이 아니어도 됩니다.
userprefs: 이 시각화에 적합한 선택적 환경설정 객체로 시각화 환경설정을 지정합니다.
type: htmlcode - 이 옵션은 사용자가 웹페이지에 삽입하여 iframe 내부에 시각화를 표시할 수 있는 HTML 코드 블록을 만듭니다. 가젯의 정확한 html 요소가 포함된 팝업 창이 브라우저에서 열립니다.가젯 버전에서 시각화를 사용할 수 있는 경우에만 사용하세요.
데이터 소스: 데이터 소스 URL 문자열입니다.
gadget: 가젯 xml URL 문자열입니다.
userprefs: 이 시각화에 적합한 선택적 환경설정 객체로 시각화 환경설정을 지정합니다.
style: iframe 스타일을 위한 문자열(선택사항)입니다.
예: '너비: 300px; 높이: 500px;'
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-07-10(UTC)"],[],[],null,["# Toolbar\n\n1. [Overview](#Overview)\n2. [Example](#Example)\n3. [Usage](#usage)\n 1. [Output Types](#outputtypes)\n 2. [Syntax](#syntax)\n4. [Data Policy](#data_policy)\n\nOverview\n--------\n\n\nYou can add a toolbar element to any visualization to enable the user to export\nthe underlying data into a CSV file or an HTML table, or\nto provide code to embed the visualization into an arbitrary web page\nor gadget.\n\n\nBy: Google\n\nExample\n-------\n\nSelect one of the options in the toolbar. \n\n```gdscript\n\u003chtml\u003e\n\u003chead\u003e\n \u003cscript type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"\u003e\u003c/script\u003e\n \u003cscript type=\"text/javascript\"\u003e\n google.charts.load('current', {packages: ['corechart']});\n var visualization;\n\n function draw() {\n drawVisualization();\n drawToolbar();\n }\n\n function drawVisualization() {\n var container = document.getElementById('visualization_div');\n visualization = new google.visualization.PieChart(container);\n new google.visualization.Query('https://spreadsheets.google.com/tq?key=pCQbetd-CptHnwJEfo8tALA').\n send(queryCallback);\n }\n\n function queryCallback(response) {\n visualization.draw(response.getDataTable(), {is3D: true});\n }\n\n function drawToolbar() {\n var components = [\n {type: 'igoogle', datasource: 'https://spreadsheets.google.com/tq?key=pCQbetd-CptHnwJEfo8tALA',\n gadget: 'https://www.google.com/ig/modules/pie-chart.xml',\n userprefs: {'3d': 1}},\n {type: 'html', datasource: 'https://spreadsheets.google.com/tq?key=pCQbetd-CptHnwJEfo8tALA'},\n {type: 'csv', datasource: 'https://spreadsheets.google.com/tq?key=pCQbetd-CptHnwJEfo8tALA'},\n {type: 'htmlcode', datasource: 'https://spreadsheets.google.com/tq?key=pCQbetd-CptHnwJEfo8tALA',\n gadget: 'https://www.google.com/ig/modules/pie-chart.xml',\n userprefs: {'3d': 1},\n style: 'width: 800px; height: 700px; border: 3px solid purple;'}\n ];\n\n var container = document.getElementById('toolbar_div');\n google.visualization.drawToolbar(container, components);\n };\n\n google.charts.setOnLoadCallback(draw);\n \u003c/script\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n \u003cdiv id=\"visualization_div\" style=\"width: 270px; height: 200px;\"\u003e\u003c/div\u003e\n \u003cdiv id=\"toolbar_div\"\u003e\u003c/div\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nUsage\n-----\n\n\nAdd a toolbar to your page by calling the `google.visualization.drawToolbar()`\nmethod, populating it with the types of export allowed, and the data required for\neach.\n\nTo use a toolbar, your visualization must get its data from a URL; you cannot\npass in hand-populated DataTable or DataView objects. You will pass the URL of\nthe data used to populate your visualization into the `drawToolbar()` method.\n\nIf you want to provide an iGoogle component or an embeddable iFrame that holds\nthe gadget, you must have a URL for a gadgetized version of the visualization.\n\n### Output Types\n\nThe toolbar can offer the user the choice of one or more of the following output\ntypes, depending on how you configure your toolbar in the `drawToolbar()` method:\n\n- A simple CSV version of the data (which your browser will either render or offer to download and save, depending on your browser configuration, and/or\n- An HTML table holding the data, opened in a new browser window, and/or\n- HTML \\\u003ciframe\\\u003e code to embed this visualization in a web page, and/or\n- A link to page enabling the user to embed this gadget in their iGoogle page.\n\n### Syntax\n\n```\ngoogle.visualization.drawToolbar(container, components)\n```\n\n#### Parameters\n\n*container*\n: A handle to a DOM element on the page. The API will draw the toolbar into this\n element. This is similar to the container parameter for a standard visualization.\n You should put the toolbar adjacent to the visualization that uses it.\n\n*components*\n: An array of objects, each describing a format that the data, or the visualization,\n can be exported to. The toolbar will expose the options to the user in the order\n added to the array. Each object has a type property describing the format, and\n one or more additional properties, depending on the type:\n\n - `type: 'csv'` - This option exports the data to a comma-separated value file. A 'save as' dialog will open in the browser.\n - **datasource** : '*string*' - The data source url.\n - `type: html'` - This option exports the data to an HTML table. The page with the data table will open in a new window in the browser.\n - **datasource**: The data source url string.\n - `type: igoogle` - This option enables the user to add the visualization to their iGoogle page. An 'add to iGoogle' page will open in the browser. *Use\n this only if the visualization is available in a gadgetized version.*\n - **datasource**: The data source url string.\n - **gadget**: The gadgetized version's xml url string. Note that the visualization that the toolbar is associated with does not have to be the gadgetized version.\n - **userprefs**: An optional preferences object appropriate for this visualization, specifying the visualization preferences.\n - `type: htmlcode` - This option creates a block of HTML code that the user can embed in a web page to display the visualization inside an iframe. A popup window with the exact html element of the gadget will open in the browser.*Use this only if the visualization is available in\n a gadgetized version.*\n - **datasource**: The data source url string.\n - **gadget**: The gadget xml url string.\n - **userprefs**: An optional preferences object appropriate for this visualization, specifying the visualization preferences.\n - **style**: An optional string for the style of the iframe. For example: 'width: 300px; height: 500px;'.\n\n### Example\n\n```gdscript\nfunction drawToolbar() {\n var components = [\n {type: 'igoogle', datasource: 'https://spreadsheets.google.com/tq?key=pCQbetd-CptHnwJEfo8tALA',\n gadget: 'https://www.google.com/ig/modules/pie-chart.xml',\n userprefs: {'3d': 1}},\n {type: 'html', datasource: 'https://spreadsheets.google.com/tq?key=pCQbetd-CptHnwJEfo8tALA'},\n {type: 'csv', datasource: 'https://spreadsheets.google.com/tq?key=pCQbetd-CptHnwJEfo8tALA'},\n {type: 'htmlcode', datasource: 'https://spreadsheets.google.com/tq?key=pCQbetd-CptHnwJEfo8tALA',\n gadget: 'https://www.google.com/ig/modules/pie-chart.xml'}\n ];\n\n var container = document.getElementById('toolbar_div');\n google.visualization.drawToolbar(container, components);\n};\n```\n\nData Policy\n-----------\n\n\nAll code and data are processed and rendered in the browser. No data is sent to any server.\nFor some components, the data is taken from the respective data source given to the toolbar.\n\nLocalization\n------------\n\nThe toolbar currently only supports US English."]]