>
> ok, let's try to solve this now. I feel like I am very close to ut but 
> there must be someting I am missing.
>
> First of all, I've been able to implement dataview in the code and I am 
> very happy with that since I wasn't sure I would be able to.
>
> The problem is I really can't depict annotations correctly within the 
> chart.
>
> let's go step by step following the code.
>
> This is the whole code I am using
>
>
>
> google.charts.load('current', {'packages':['corechart']});
>
>
> google.charts.setOnLoadCallback(drawGID);
>
>
> function drawGID() {
>
>
>
> var query = new google.visualization.Query(
>
> 'https://docs.google.com/spreadsheets/d/1-j2QlD8lXvmWQJAyjWRtHO3PSYurCSjbYkn_5K5pBj0/gviz/tq?gid=0&sheet=dca'/*
>  
> + queryString*/);
> //I chose to draw only a small part of the sheet, for the sake of 
> simplicity
> query.setQuery('select A, I limit 40 offset 2');
>
> query.send(handleQueryResponse);
> } //fine funzione drawGID
>
>
> function handleQueryResponse(response) {
> if (response.isError()) {
> alert('Error in query: ' + response.getMessage() + ' ' + response.
> getDetailedMessage());
> return;
> }
>
>
> // Set chart options
>         var options = {'title':'Ceci n est pas un graphique',
>                        'width':'1300',
>                        'height':'1000',
>                        'hAxis':{'title':'time (mesi)'},
>                        'vAxis':{'title':'price'},
>                        'lineWidth':'2',
>                        explorer: { actions: ['dragToZoom', 
> 'rightClickToReset'], maxZoomIn: .01}
>                        };// fine options
>  
> var data = response.getDataTable();
>
> //da qui proviamo dataview
>     var view = new google.visualization.DataView(data);
>     view.setColumns([0,1/*,
>       2/*,
>       {
>         // calc: 'stringify',
>         // type: 'string',
>         sourceColumn: 2,
>         role: 'certainty'
>       }/*,
>       3,
>       {
>         calc: "stringify",
>         sourceColumn: 3,
>         type: "string",
>         role: "annotationText"
>       }*/
>     ]);
>
>
> var chart = new google.visualization.LineChart(document.getElementById(
> 'chart_div'));
> chart.draw(view, options/*{ height: 800 }*/);
> } //fine funzione handleQueryResponse
>
>
>
> and this is the sheet we'll be referring to:
>

https://docs.google.com/spreadsheets/d/1-j2QlD8lXvmWQJAyjWRtHO3PSYurCSjbYkn_5K5pBj0/edit#gid=1892761984



Now, if as you can see we try to draw ONLY two columns (A, I) it works 
fine: 

[image: FireShot Capture 012 - Scenario Chart - .png]

this means that dataview works.


Now, if I try to include column AT (see the linked sheet ) as annotation 
column what happens is a blank page

this is the code I use (I'll post only the variations):


var query = new google.visualization.Query(
'https://docs.google.com/spreadsheets/d/1-j2QlD8lXvmWQJAyjWRtHO3PSYurCSjbYkn_5K5pBj0/gviz/tq?gid=0&sheet=dca'/*
 
+ queryString*/);
query.setQuery('select A, I, AT limit 40 offset 2');

//query.setQuery('select A, H, P, Q, R, S, T, U, E, F, G limit 40 offset 
2');
query.send(handleQueryResponse);


//da qui proviamo dataview
    var view = new google.visualization.DataView(data);
    view.setColumns([0,1,
      2,
      {
 // calc: 'stringify',
 // type: 'string',
        sourceColumn: 2,
        role: 'annotation'
      }
    ]);



You may think that the problem is that I commented 
 // calc: 'stringify',
 // type: 'string',

but it' not of course because even if you uncomment them nothing changes.

And, besides, if you look at the reference from google itself 
<https://developers.google.com/chart/interactive/docs/reference#DataView_setColumns>
 
it's specified that in the presence of sourceColumn you don't need to 
specify neither the *calc *command nor the *type:*

sourceColumn - [*Optional*, *number*] The source column to use as a value; 
> if specified, do not specify the calc or the type property. This is 
> similar to passing in a number instead of an object, but enables you to 
> specify a role and properties for the new column.             


 

Then, as a third outcome, if I try to pass a simple column (AR) and mark it 
as *certainty *(which is absolutely nonsense), it somehow manages to depict 
it, but of course without any real usability:

[image: FireShot Capture 014 - Scenario Chart - .png]

var query = new google.visualization.Query(
'https://docs.google.com/spreadsheets/d/1-j2QlD8lXvmWQJAyjWRtHO3PSYurCSjbYkn_5K5pBj0/gviz/tq?gid=0&sheet=dca'/*
 
+ queryString*/);
query.setQuery('select A, I, AR limit 40 offset 2');
//query.setQuery('select A, H, P, Q, R, S, T, U, E, F, G limit 40 offset 
2');
query.send(handleQueryResponse);

//da qui proviamo dataview
    var view = new google.visualization.DataView(data);
    view.setColumns([0,1,
      2,
      {
// calc: 'stringify',
// type: 'string',
        sourceColumn: 2,
        role: 'certainty'
      }
    ]);


now: what am I missing?

thanks

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/8732e176-6a7f-4a0f-970a-b2fb8fc44ab7%40googlegroups.com.

Reply via email to