powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / Google Charts . Кто умеет строить несколько графиков в одной сист. координат ?
4 сообщений из 4, страница 1 из 1
Google Charts . Кто умеет строить несколько графиков в одной сист. координат ?
    #37787363
andron81
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
собственно вопрос в наименовании темы.

Как это делается ? особо ведь нигде не документировано явно.

2 графика есть в примере "Area Chart" , переделал его в тот что мне нужно :

Код: javascript
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
var data = new google.visualization.DataTable();


data.addColumn('datetime', 'Date1');
data.addColumn('number',   'E2');
data.addColumn('number',   'E3');


data.addRows(3);
data.setCell(0, 0, new Date(2006, 1, 28, 10,30,01));
data.setCell(0, 1, 100 );
data.setCell(0, 2, 200 );
data.setCell(1, 0, new Date(2007, 1, 28, 10,30,01));
data.setCell(1, 1, 10 );
data.setCell(1, 2, 11 );
data.setCell(1, 0, new Date(2008, 1, 28, 10,30,01));
data.setCell(2, 1, 130 );
data.setCell(2, 2, 90 );



        var options = {
          title: 'Company Performance',
          hAxis: {title: 'Year',  titleTextStyle: {color: 'red'}},
          pointSize: 5 
        };

        var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>



но не подходит по причине того что у 2 - х графиков могут быть разные абсциссы. а в данном случае табличное представление задаёт именно одинаковые абсциссы. То есть в примере выше данные идут так , что у одного есть точка ((2006, 1, 28, 10,30,01) , 100), а у другого ((2006, 1, 28, 10,30,01), 200). а как сделать , что скажем у одного точка ((2006, 1, 28, 10,30,01) , 100) имеется , а другово с абсциссой x=(2006, 1, 28, 10,30,01) точки нет ?
если кто понял вопрос )))) и есть альтруистическое желание помочь подскажите, пожалуйста ;)

Модератор: Тема перенесена из форума "Java".
...
Рейтинг: 0 / 0
Google Charts . Кто умеет строить несколько графиков в одной сист. координат ?
    #37878739
akim2
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src=" http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
</script>

<script type="text/javascript">
function drawVisualization() {
var data = new google.visualization.DataTable();

data.addColumn('string', 'Fill up');
data.addColumn('number', 'Gallons');
data.addColumn({type:'string', role:'tooltip'});
data.addColumn('number', 'MPG');
data.addColumn({type:'string', role:'tooltip'});
data.addColumn('number', 'Mileage');
data.addColumn({type:'string', role:'tooltip'});

data.addRows([
['05/24', 13.92, 'Fill up: 05/24\nGalons: 13.92\nMPG: 19.7\nMileage: 7124\nStation: Shell', 13.99, 'Fill up: 05/24\nGalons: 13.92\nMPG: 19.7\nMileage: 7124\nStation: Shell', 7.67, 'Fill up: 05/24\nGalons: 13.92\nMPG: 19.7\nMileage: 7124\nStation: Shell'],
['06/07', 10.70, 'Fill up: 06/07\nGalons: 10.70\nMPG: 19.5\nMileage: 7333\nStation: BP', 13.85, 'Fill up: 06/07\nGalons: 10.70\nMPG: 19.5\nMileage: 7333\nStation: BP', 7.89, 'Fill up: 06/07\nGalons: 10.70\nMPG: 19.5\nMileage: 7333\nStation: BP'],
['06/23', 15.39, 'Fill up: 06/23\nGalons: 15.39\nMPG: 19.9\nMileage: 7640\nStation: BP', 14.13, 'Fill up: 06/23\nGalons: 15.39\nMPG: 19.9\nMileage: 7640\nStation: BP', 8.22, 'Fill up: 06/23\nGalons: 15.39\nMPG: 19.9\nMileage: 7640\nStation: BP'],
['06/28', 12.80, 'Fill up: 06/28\nGalons: 12.80\nMPG: 19.1\nMileage: 7884\nStation: TNK', 13.56, 'Fill up: 06/28\nGalons: 12.80\nMPG: 19.1\nMileage: 7884\nStation: TNK', 8.48, 'Fill up: 06/28\nGalons: 12.80\nMPG: 19.1\nMileage: 7884\nStation: TNK'],
['07/05', 14.73, 'Fill up: 07/05\nGalons: 14.73\nMPG: 17.5\nMileage: 8142\nStation: John&John', 12.43, 'Fill up: 07/05\nGalons: 14.73\nMPG: 17.5\nMileage: 8142\nStation: John&John', 8.76, 'Fill up: 07/05\nGalons: 14.73\nMPG: 17.5\nMileage: 8142\nStation: John&John'],
['07/05', 7.67, 'Fill up: 07/05\nGalons: 7.67\nMPG: 18.9\nMileage: 8287\nStation: Steve Best Gas', 13.42, 'Fill up: 07/05\nGalons: 7.67\nMPG: 18.9\nMileage: 8287\nStation: Steve Best Gas', 8.92, 'Fill up: 07/05\nGalons: 7.67\nMPG: 18.9\nMileage: 8287\nStation: Steve Best Gas']
]);

// Create and draw the visualization.
new google.visualization.ColumnChart(document.getElementById('visualization')).
draw(data,
{
chartArea:{left:30,top:20,width:"100%",height:"75%"},
//title:"Fill up chart",
hAxis: {title: "Fill up"},
vAxis: {title: "Gallons"},
width:320,
height:335,
seriesType: "bars",
legend: {position: "in"},
series: {
0: {pointSize: 5},
1: {type: "line", pointSize: 5},
2: {type: "line", pointSize: 10}}
}
);
}

google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="visualization"></div>
</body>
</html>
...
Рейтинг: 0 / 0
Google Charts . Кто умеет строить несколько графиков в одной сист. координат ?
    #37878938
ShSerge
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
оффавторМодератор: Тема перенесена из форума "Java".

Тьфу-ты! Я уже было поверил, что на форуме про яву модератор, наконец-то, появился.
А это оказывается аж с 10-го мая. :(
...
Рейтинг: 0 / 0
Google Charts . Кто умеет строить несколько графиков в одной сист. координат ?
    #37879000
andron81
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
akim2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src=" http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
</script>

<script type="text/javascript">
function drawVisualization() {
var data = new google.visualization.DataTable();

data.addColumn('string', 'Fill up');
data.addColumn('number', 'Gallons');
data.addColumn({type:'string', role:'tooltip'});
data.addColumn('number', 'MPG');
data.addColumn({type:'string', role:'tooltip'});
data.addColumn('number', 'Mileage');
data.addColumn({type:'string', role:'tooltip'});

data.addRows([
['05/24', 13.92, 'Fill up: 05/24\nGalons: 13.92\nMPG: 19.7\nMileage: 7124\nStation: Shell', 13.99, 'Fill up: 05/24\nGalons: 13.92\nMPG: 19.7\nMileage: 7124\nStation: Shell', 7.67, 'Fill up: 05/24\nGalons: 13.92\nMPG: 19.7\nMileage: 7124\nStation: Shell'],
['06/07', 10.70, 'Fill up: 06/07\nGalons: 10.70\nMPG: 19.5\nMileage: 7333\nStation: BP', 13.85, 'Fill up: 06/07\nGalons: 10.70\nMPG: 19.5\nMileage: 7333\nStation: BP', 7.89, 'Fill up: 06/07\nGalons: 10.70\nMPG: 19.5\nMileage: 7333\nStation: BP'],
['06/23', 15.39, 'Fill up: 06/23\nGalons: 15.39\nMPG: 19.9\nMileage: 7640\nStation: BP', 14.13, 'Fill up: 06/23\nGalons: 15.39\nMPG: 19.9\nMileage: 7640\nStation: BP', 8.22, 'Fill up: 06/23\nGalons: 15.39\nMPG: 19.9\nMileage: 7640\nStation: BP'],
['06/28', 12.80, 'Fill up: 06/28\nGalons: 12.80\nMPG: 19.1\nMileage: 7884\nStation: TNK', 13.56, 'Fill up: 06/28\nGalons: 12.80\nMPG: 19.1\nMileage: 7884\nStation: TNK', 8.48, 'Fill up: 06/28\nGalons: 12.80\nMPG: 19.1\nMileage: 7884\nStation: TNK'],
['07/05', 14.73, 'Fill up: 07/05\nGalons: 14.73\nMPG: 17.5\nMileage: 8142\nStation: John&John', 12.43, 'Fill up: 07/05\nGalons: 14.73\nMPG: 17.5\nMileage: 8142\nStation: John&John', 8.76, 'Fill up: 07/05\nGalons: 14.73\nMPG: 17.5\nMileage: 8142\nStation: John&John'],
['07/05', 7.67, 'Fill up: 07/05\nGalons: 7.67\nMPG: 18.9\nMileage: 8287\nStation: Steve Best Gas', 13.42, 'Fill up: 07/05\nGalons: 7.67\nMPG: 18.9\nMileage: 8287\nStation: Steve Best Gas', 8.92, 'Fill up: 07/05\nGalons: 7.67\nMPG: 18.9\nMileage: 8287\nStation: Steve Best Gas']
]);

// Create and draw the visualization.
new google.visualization.ColumnChart(document.getElementById('visualization')).
draw(data,
{
chartArea:{left:30,top:20,width:"100%",height:"75%"},
//title:"Fill up chart",
hAxis: {title: "Fill up"},
vAxis: {title: "Gallons"},
width:320,
height:335,
seriesType: "bars",
legend: {position: "in"},
series: {
0: {pointSize: 5},
1: {type: "line", pointSize: 5},
2: {type: "line", pointSize: 10}}
}
);
}

google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="visualization"></div>
</body>
</html>


это не то что мне надо. я же говорил. у тебя во всех контрольных точках на всех 3 графиках абсциссы одинаковые. а мне надо , чтобы разные были.
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / Google Charts . Кто умеет строить несколько графиков в одной сист. координат ?
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]