Multiplos valores eixo X

50 views
Skip to first unread message

Uzilin

unread,
May 20, 2012, 11:13:31 PM5/20/12
to Google Visualization API
Bom galera, estou com uma duvida, quando vou gerar o gráfico de linha
com sobreposição de curvas é definido N valores de Y para 1 valor de X
ou seja, em um gráfico q contem 2 curvas sobrepostas, em um valor de X
eu tenho 2 valores de Y, porem estou com um problema, o gráfico q
quero gerar não tem os mesmos valores de Y para um valor de X, por
exemplo:
uma curva seria:
(1, 2); (2, 4); (3, 3).
Oma outra curva seria:
(0.5, 0.5); (1.5,3; (3,1).

Gostaria de uma ideia para gerar este gráfico de linha.

Obrigado.

MC Get Vizzy

unread,
May 21, 2012, 6:53:53 AM5/21/12
to google-visua...@googlegroups.com
The line chart data format is not ideally suited to your use case.

You could use null values to pad your data, as in

x,y1,y2
1,4,
2,,5
3,5,
4,,4
5,9,
6,,4

You could also have a look at the BubbleChart, which does have a data format like yours:


2012/5/21 Uzilin <uzi...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


Rafael Uzilin

unread,
May 21, 2012, 3:49:29 PM5/21/12
to google-visua...@googlegroups.com
I need a line chart to compare those values, i need to analyze a function, the best function would be the highest curve on the chart for example. That's the reason i use a line chart. I can't let values "null", when i do it, the chart isn't generated.

2012/5/21 MC Get Vizzy <getv...@google.com>



--
Rafael Uzilin Francisco
Graduando do Curso de Gestão de Produção Industrial
Instituto Federal de Educação, Ciência e Tecnologia de São Paulo - IFSP
Campus Salto
Fone: (19)98517545 / (19)94461571 / (19)33120554

MC Get Vizzy

unread,
May 22, 2012, 5:44:38 AM5/22/12
to google-visua...@googlegroups.com
Really?  What happens when you set DataTable values to null?  Do you see an error?

Rafael Uzilin

unread,
May 22, 2012, 8:13:48 AM5/22/12
to google-visua...@googlegroups.com
i was using another way to build the chart, now i did lke you said, with a table, but on null values, it creates gaps.
I don't want these gaps, i want a continue line, do you know some way to build it?
Here is the code, if you paste on the lineChart playground, you'll see the gaps.

function drawVisualization() {
  // Create and populate the data table.
 
var data = new google.visualization.DataTable();

  // Declare columns
  data.addColumn('string', 'velocidade');
  data.addColumn('number', 'altitude');  
  data.addColumn('number', 'altitude2');
  
  data.addRow(['1', 2, 3]);
  data.addRow(['1.2', 2.5, 3.2]);
  data.addRow(['1.5', , 3.5]);
  data.addRow(['2', 3, 4]);
  data.addRow(['3', 3, 5]);
  data.addRow(['4', 3, null ]);
  data.addRow(['5', 3, 7]);
  data.addRow(['6', 4, 8]);
  
  // Create and draw the visualization.
  new google.visualization.LineChart(document.getElementById('visualization')).
      draw(data, {curveType: "function",
                  width: 500, height: 400,
                  vAxis: {maxValue: 10}}
          );
}



2012/5/22 MC Get Vizzy <getv...@google.com>

asgallant

unread,
May 22, 2012, 9:54:53 AM5/22/12
to google-visua...@googlegroups.com
Set the "interpolateNulls" option to true.

2012/5/21 Uzilin <uzi...@gmail.com>
To post to this group, send email to google-visualization-api@googlegroups.com.
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visualization-api@googlegroups.com.
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
--
Rafael Uzilin Francisco
Graduando do Curso de Gestão de Produção Industrial
Instituto Federal de Educação, Ciência e Tecnologia de São Paulo - IFSP
Campus Salto
Fone: (19)98517545 / (19)94461571 / (19)33120554


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visualization-api@googlegroups.com.
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visualization-api@googlegroups.com.
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

Rafael Uzilin

unread,
May 22, 2012, 12:00:16 PM5/22/12
to google-visua...@googlegroups.com
Problem solved, if someone wants an example, here is my code on the playground.



function drawVisualization() {
  // Create and populate the data table.
 
var data = new google.visualization.DataTable();

  // Declare columns
  data.addColumn('string', 'velocidade');
  data.addColumn('number', 'altitude');  
  data.addColumn('number', 'altitude2');
  
  data.addRow(['1', 2, 3]);
  data.addRow(['1.2', 2.5, 3.2]);
  data.addRow(['1.5', , 3.5]);
  data.addRow(['2', 3, 4]);
  data.addRow(['3', 3, 5]);
  data.addRow(['4', 3, null ]);
  data.addRow(['5', 3, 7]);
  data.addRow(['6', 4, 8]);
  
  // Create and draw the visualization.
  new google.visualization.LineChart(document.getElementById('visualization')).
      draw(data, interpolateNulls:true,

        curveType: "function",
                  width: 500, height: 400,
                  vAxis: {maxValue: 10}}
          );
}

Thank you.

2012/5/22 asgallant <drew_g...@abtassoc.com>
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/rqPEAtJ5oX4J.

To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
Reply all
Reply to author
Forward
0 new messages