자바스크립트 API를 사용하여 Google 차트의 스타일을 지정하고 있습니다. 데이터가 그려지는 영역의 배경을 변경하고 싶습니다. 어떤 이유에서인지 배경 옵션을 이렇게 설정했습니다:
chart.draw(data, { backgroundColor: { fill: "#F4F4F4" } })
데이터가 그려진 영역이 아닌 전체 차트의 배경이 변경됩니다. 플롯된 영역의 배경만 변경하는 방법에 대한 아이디어가 있나요? Thanks
다음과 같이 옵션을 전달합니다.
var options = {
title: 'title',
width: 310,
height: 260,
backgroundColor: '#E4E4E4',
is3D: true
};
이 경우 구글은 구글 차트 클래식 차트 또는 재료에 따라 적절한 답을 점입니다. 클래식 버전은 구글 차트를 사용하는 경우, 위의 배수인지 제안 작업. 그러나 새로운 재료 유형을 지정할 수 있습니다 다음 구글 차트를 사용하는 경우, 또는 로 변환하십시오 다르게 옵션 (http://otl. '구글레스카르츠실바스컨베르토티언스 (옵션)' 참조). 재료) 의 경우, 그 위에 지정하면 불투명도의 차트 # 39, t (만), 전체에 대해 차트입니다 불투명도입니다 won& 신청을 차트입니다 영역. 그래서 니말은 명시적으로 지정해야 할 뿐만 아니라 같은 색 컬러를 불투명도의 영역에 대한 차트입니다 대해서도 조합으로의.
일반적으로: 일부 기능을 기본 재료 버전의 구글 차트 부족한 것이 있다 (경사 축 레이블, 컬러링, 콤보 차트에 이름을 추세 분석을, 사용자 정의 열 몇) 및 비차 versa. 포맷 중 수 있으며 이중 (트리플 (quadruple.) 재료 버전 axes 통해서만 지원됩니다.
가끔 기능을 지원하지 않는 경우에 필요한 재료 차트입니다 모두 다른 형식의 옵션.
<body>
<div id="classic_div"></div>
<div id="material_div"></div>
</body>
JS:
google.charts.load('current', { 'packages': ['corechart', 'bar'] });
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540],
['2009', 1120, 580],
['2010', 1200, 500],
['2011', 1250, 490],
]);
var options = {
width: 1000,
height: 600,
chart: {
title: 'Company Performance',
subtitle: 'Sales, Expenses, and Profit: 2014-2017'
},
// Accepts also 'rgb(255, 0, 0)' format but not rgba(255, 0, 0, 0.2),
// for that use fillOpacity versions
// Colors only the chart area, simple version
// chartArea: {
// backgroundColor: '#FF0000'
// },
// Colors only the chart area, with opacity
chartArea: {
backgroundColor: {
fill: '#FF0000',
fillOpacity: 0.1
},
},
// Colors the entire chart area, simple version
// backgroundColor: '#FF0000',
// Colors the entire chart area, with opacity
backgroundColor: {
fill: '#FF0000',
fillOpacity: 0.8
},
}
var classicChart = new google.visualization.BarChart(document.getElementById('classic_div'));
classicChart.draw(data, options);
var materialChart = new google.charts.Bar(document.getElementById('material_div'));
materialChart.draw(data, google.charts.Bar.convertOptions(options));
}
바이올린 데모:
옵션을 사용하여 쉽게.
drawChart() {
// Standard google charts functionality is available as GoogleCharts.api after load
const data = GoogleCharts.api.visualization.arrayToDataTable([
['Chart thing', 'Chart amount'],
['Na Meta', 50],
['Abaixo da Meta', 22],
['Acima da Meta', 10],
['Refugos', 15]
]);
let options = {
backgroundColor: {
gradient: {
// Start color for gradient.
color1: '#fbf6a7',
// Finish color for gradient.
color2: '#33b679',
// Where on the boundary to start and
// end the color1/color2 gradient,
// relative to the upper left corner
// of the boundary.
x1: '0%', y1: '0%',
x2: '100%', y2: '100%',
// If true, the boundary for x1,
// y1, x2, and y2 is the box. If
// false, it's the entire chart.
useObjectBoundingBoxUnits: true
},
},
};
const chart = new GoogleCharts.api.visualization.ColumnChart(this.$.chart1);
chart.draw(data, options);
}
! [스케쳐내 같은 데 도움이 될 것이라고 할 수 있는 그런] [1]
스케쳐내 이렇게 할 수 있는 그런 것이 도움이 된다. 내가 사용하는 영역에 있는 '에서 언급한' 차트입니다 콤보 차트입니다 구글 라이브러리란. 각 영역에 대한 공세를 강화하고 있는 값을 값이 상태였습니다.
다음은 https://partner. 장치당 [이스피들 코드] [2]