I found the issue. While building the datasource I enclosed the items in single quotes which denote string whereas I shouldn't since my column was type of number.
Thanks On Dec 11, 1:34 pm, Antonis Panagi <[email protected]> wrote: > I'm using exactly the same datasource. > > > > > > > > On Sun, Dec 11, 2011 at 12:11 PM, Roni Biran <[email protected]> wrote: > > The datasource needs to be the same. Are you rendering different datatable > > for the LineChart? > > > On Sun, Dec 11, 2011 at 12:07 PM, Antonis Panagi > > <[email protected]>wrote: > > >> hehe. > > >> The pie chart works. The line chart is not working > > >> On Sun, Dec 11, 2011 at 11:47 AM, Roni Biran <[email protected]>wrote: > > >>> So if all work fine I'm pleased... > > >>> On Sun, Dec 11, 2011 at 11:42 AM, Antonis Panagi > >>> <[email protected]>wrote: > > >>>> Roni thanks for your reply. > >>>> I'm using the MVC3 Razor syntax. > > >>>> var datasource = []; > > >>>> foreach(var item in Model) > >>>> { > >>>> <text> > >>>> datasource.push(['[email protected]']) > >>>> </text> > >>>> } > > >>>> where @item.TotalForMonth is integer type > > >>>> I have used the same code for pie chart and pie chart works. > >>>> Thanks > > >>>> On Sun, Dec 11, 2011 at 9:39 AM, Roni Biran <[email protected]>wrote: > > >>>>> Hi, > > >>>>> The datasource (as you pointed) should be in your case a JSON format > >>>>> datatable object, as in the following format: > > >>>>> var data = new google.visualization.DataTable( > >>>>> { > >>>>> cols: [{id: 'task', label: 'Task', type: 'string'}, > >>>>> {id: 'hours', label: 'Hours per Day', type: 'number'}], > >>>>> rows: [{c:[{v: 'Work'}, {v: 11}]}, > >>>>> {c:[{v: 'Eat'}, {v: 2}]}, > >>>>> {c:[{v: 'Commute'}, {v: 2}]}, > >>>>> {c:[{v: 'Watch TV'}, {v:2}]}, > >>>>> {c:[{v: 'Sleep'}, {v:7, f:'7.000'}]} > >>>>> ] > >>>>> }, > >>>>> 0.6 > >>>>> ) > > >>>>> so unless your data looks like this, your chart will not be shown. > > >>>>> On Sun, Dec 11, 2011 at 2:01 AM, William Espindola < > >>>>> [email protected]> wrote: > > >>>>>> What I am talking about is the way that you are seeking this data. > >>>>>> Take a look here in this documentation: > >>>>>>http://code.google.com/apis/chart/interactive/docs/php_example.html > >>>>>> Any questions just ask > >>>>>> On Dec 10, 9:13 pm, Antonis Panagi <[email protected]> wrote: > >>>>>> > I'm loading the data from outside (db). I do not think that the > >>>>>> problem is > >>>>>> > not loading the data because I checked my datasource and it has > >>>>>> about 200 > >>>>>> > records in it. If you see also the error message I get "Value > >>>>>> 364390" it > >>>>>> > means that there is some data. The problem is parsing of this data. > >>>>>> I > >>>>>> > checked the type before adding it to the datasource and is type of > >>>>>> decimal. > > >>>>>> > Thanks, > > >>>>>> > AP > > >>>>>> > On Sat, Dec 10, 2011 at 10:29 PM, William Espindola < > >>>>>> [email protected]>wrote: > > >>>>>> > > I think this error is happening because you are not loading the > >>>>>> data. > >>>>>> > > Tell me, this Will be static data or you will bring an outside > >>>>>> source? > >>>>>> > > On Dec 10, 11:49 am, pantonis <[email protected]> wrote: > >>>>>> > > > Hi, > > >>>>>> > > > I'm trying to create a Line chart and I get the following error: > > >>>>>> > > > Type mismatch. Value 364390 does not match type number in > >>>>>> column index > >>>>>> > > > 0 > >>>>>> > > > [Break On This Error] function Mq(a,b,c){if(c!=k){var > >>>>>> a=a[Qb...ch type > >>>>>> > > > "+a+" in column index "+b))}} > > >>>>>> > > > I'm populating the datasource with typeof int. Do you know > >>>>>> what's > >>>>>> > > > causing this error? > >>>>>> > > > Below is my code > > >>>>>> > > > function drawChart() { > >>>>>> > > > var data = new google.visualization.DataTable(); > >>>>>> > > > data.addColumn('number', 'Amount'); > >>>>>> > > > data.addRows(datasource); > > >>>>>> > > > var options = { > >>>>>> > > > width: 800, height: 480, > >>>>>> > > > title: 'Top sales' > >>>>>> > > > }; > > >>>>>> > > > var chart = new > > >>>>>> google.visualization.LineChart(document.getElementById('chart_div')); > >>>>>> > > > chart.draw(data, options); > >>>>>> > > > } > > >>>>>> > > -- > >>>>>> > > You received this message because you are subscribed to the > >>>>>> Google Groups > >>>>>> > > "Google Visualization API" group. > >>>>>> > > To post to this group, send email to > >>>>>> > > [email protected]. > >>>>>> > > To unsubscribe from this group, send email to > >>>>>> > > [email protected]. > >>>>>> > > 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 > >>>>>> [email protected]. > >>>>>> To unsubscribe from this group, send email to > >>>>>> [email protected]. > >>>>>> 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 > >>>>> [email protected]. > >>>>> To unsubscribe from this group, send email to > >>>>> [email protected]. > >>>>> 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 > >>>> [email protected]. > >>>> To unsubscribe from this group, send email to > >>>> [email protected]. > >>>> 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 > >>> [email protected]. > >>> To unsubscribe from this group, send email to > >>> [email protected]. > >>> 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 > >> [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]. > >> 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 > > [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
