I see.  Yes, you can add "Alianza" to the DataTable in order to make the 
table at the top of your image.  That format will not work for the chart, 
however, so you have to create a DataView that splits the data into 
different columns depending on the value of "Alianza".

data.addColumn('number', 'COOX');
data.addColumn('number', 'COOY');
data.addColumn({type: 'string' role: 'tooltip', properties: {html: true}});
data.addColumn('string', 'Alianza');

<?php 
$Listar_grafico = mysql_query("SELECT * FROM players"); 
while ($row = mysql_fetch_array($listar_graph)) {
?> 
    data.addRow ([<?=$row['coox']?>, <?=$row['cooy']?>, 
'<?=$row['jugador']?>', '<?=$row['alianza']?>']); 
<?php
mysql_free_result($listar_graph);
?> 

var alianzas = data.getDistinctValues(3); // get a list of all "Alianza"s
var columns = [0];
for (var i = 0; i < alianzas.length; i++) {
    columns.push({
        type: 'number',
        label: alianzas[i],
        calc: (function (x) {
            return function (dt, row) {
                return (dt.getValue(row, 3) == alianzas[x]) ? 
dt.getValue(row, 1) : null;
            };
        })(i)
    });
    columns.push({
        type: 'number',
        role: 'tooltip',
        properties: {isHtml: true},
        calc: (function (x) {
            return function (dt, row) {
                return (dt.getValue(row, 3) == alianzas[x]) ? 
dt.getValue(row, 2) : null;
            };
        })(i)
    });
}
var view = new google.visualization.DataView(data);

Draw the chart using the DataView instead of the DataTable.  You can set 
the colors in the chart's "colors" option.  I made an example of this for 
you to follow: http://jsfiddle.net/asgallant/bMNYE/

On Sunday, November 3, 2013 2:38:14 PM UTC-5, Santiago Fernandez wrote:
>
> En mi pais hay un dicho, que Una imagen dice mas que mil palabras.
>
> http://imm.io/1jMa7
>
> Esto es lo que pretendo hacer Assgalant.
>
> El 02/11/2013, a las 12:47, Fernandez Santiago 
> <[email protected]<javascript:>> 
> escribió:
>
> Mi ingles es muy malo.
>
> Gracias por la atención, asgallant.
>
> Quiero crear un grafico de intersecciones. Lo he logrado. Ahora la idea es 
> dividir en 2. Con un color en base a un campo de la tabla y con otro color 
> en base a ese mismo campo.
>
> Ejemplo.
>
> var data = new google.visualization.DataTable();
>>> data.addColumn('number', 'coox');
>>> data.addColumn('number', 'cooy');
>>>      data.addColumn({type:'string', role:'tooltip', 'jugador': {'html': 
>>> true}}); // tooltip for first series
>>
>>
> agregar,
>
> data.addColumn(’string’,’alianza’);
>
> Datos de la Tabla
>
> Si alianza = ‘alianza’ uso color Rojo y si no uso color Azul.
>
> Dividir en 2 grupos el grafico.
>
> Logras entender?
>
> Muchisimas gracias!!
>
>
>
> El 02/11/2013, a las 12:12, asgallant <[email protected]<javascript:>> 
> escribió:
>
> I'm sorry, but I don't understand your questions.  If you ask the 
> questions in your native language, I can try to have them translated.
>
> On Friday, November 1, 2013 11:29:00 PM UTC-4, Santiago Fernandez wrote:
>>
>> Dear,
>>
>> I'm not a developer. Then, a lot of effort to achieve graph a Scratter 
>> with the following code.
>>
>> This One...
>>
>> <script type="text/javascript">
>>> google.load("visualization", "1", {packages:["corechart"]});
>>> google.setOnLoadCallback(drawChart);
>>> function drawChart() {
>>> var data = new google.visualization.DataTable();
>>> data.addColumn('number', 'coox');
>>> data.addColumn('number', 'cooy');
>>>     data.addColumn({type:'string', role:'tooltip', 'jugador': {'html': 
>>> true}}); // tooltip for first series
>>>     <?php
>>>     $listar_grafico = mysql_query("SELECT * FROM jugadores");
>>>     while ($row = mysql_fetch_array($listar_grafico)) {
>>>     ?>
>>>     data.addRow([<?=$row['coox']?>, <?=$row['cooy']?>, 
>>> '<?=$row['jugador']?>']);
>>>     <?
>>>     }
>>>     mysql_free_result($listar_grafico);
>>>     ?> 
>>>     var options = {
>>>     title: 'Mapa de Alianza',
>>>     hAxis: {title: 'Eje X', minValue: 0, maxValue: 1020},
>>>     vAxis: {title: 'Eje Y', minValue: 0, maxValue: 1020},
>>>     pointSize:4,
>>>     legend: 'none'
>>>     };
>>>     var chart = new 
>>> google.visualization.ScatterChart(document.getElementById('chart_div'));
>>>     chart.draw(data, options);
>>>     }
>>>  </script>
>>
>>
>> I have some form of cross-checking with another?
>>
>> Or failing and add one more and with an IF color to the two groups of the 
>> same DataTable?
>>
>> Do you under stand me?
>>
>> Thanks!!
>>
>
> -- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "Google Visualization API" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/google-visualization-api/XXJkiugovDA/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to 
> [email protected] <javascript:>.
> To post to this group, send email to 
> [email protected]<javascript:>
> .
> Visit this group at 
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to