You can add '\n' characters to your data values to force the corresponding tick labels to wrap. This works for either string values or for the formatted string representation of any other value.
On Tue, Apr 7, 2015 at 1:04 AM, <[email protected]> wrote: > Hi, > > I've uplaoded two Chart images Chart1 is what i already have and chart > two is my requirement. Can anyone help me how to add ' Q1 as another row in > my chart'. > > And my code is > <script> > var twoDatas = []; > var threeDatas = []; > > var prevyear = []; > var diff; > var flagthree = false; > var flag = false; > var min = 0; > var max = 0; > var minArray = []; > var isIe8 = true; > <% int j = 0;%> > <s:iterator value="trendlinesLst"> > prevyear.push(<s:property value="year"/>); > if (<%= j - 1%> !== -1) { > flag = true; > if (prevyear[<%= j - 1%>] !== > prevyear[<%= j%>] - 1) { > diff = prevyear[<%= j%>] - > prevyear[<%= j - 1%>]; > > } > if (diff > 1) { > flagthree = true; > for (inc = 1; inc < diff; inc++) { > threeDatas.push([<s:property > value="year"/> - diff + 1 + "", null, null]); > > } > diff = 0; > } > if (!flagthree) { > threeDatas.push(['<s:property > value="year"/> ',<s:property value="members"/>, null]); > > } else if (flagthree) { > threeDatas.push(['<s:property > value="year"/>', null,<s:property value="members"/>]); > > } > } > if (!flag) { > threeDatas.push(['<s:property > value="year"/> ',<s:property value="members"/>, null]); > > } > minArray.push([<s:property > value="members"/>]); > > twoDatas.push(['<s:property > value="year"/>',<s:property value="members"/>]); > <% j++;%> > </s:iterator> > > Array.min = function(array) { > return Math.min.apply(Math, array); > }; > Array.max = function(array) { > return Math.max.apply(Math, array); > }; > > if (Array.min(minArray) > 0) { > min = Array.min(minArray) - 1; > max = Array.max(minArray); > } > > > if (flagthree) { > var data = > google.visualization.arrayToDataTable( > [['Year', 'Members with > <s:property value="%{medicalcondition_name}"/>', 'Members with <s:property > value="%{medicalcondition_name}"/>']].concat(threeDatas), false); > > > } else if (!flagthree) { > var data = > google.visualization.arrayToDataTable( > [['Year,Q1', 'Members with > <s:property value="%{medicalcondition_name}"/>']].concat(twoDatas), false); > > var dataTable = > google.visualization.arrayToDataTable( > [['', '']].concat(twoDatas), > false); > } > var tipFont = 10; > if ($('html').hasClass('lt-ie9')) { > tipFont = 11; > isIe8 = false; > } > var options = { > pointSize: 5, > width: 211, > height: 90, > backgroundColor: '#ffffff', > chartArea: { > left: 0, > top: 10, > width: 211, > height: 56 > }, > legend: {position: 'none'}, > hAxis: { > baselineColor: '#fff', > gridlineColor: '#fff', > > textStyle: {italic: false, color: > '#aaa', fontSize: 11} > }, > vAxis: { > baselineColor: '#fff', > gridlineColor: '#fff', > textPosition: 'none', > minValue: min, > maxValue: max > }, > tooltip: { > tooltip: {isHtml: true}, > textStyle: {fontSize: tipFont, > bold: isIe8} > }, > series: { > 0: { > color: '#0066CC' > }, > 1: { > color: '#0066CC' > } > } > }; > > var chart = new > google.visualization.LineChart(document.getElementById('TrendBox<%=i%>')); > chart.draw(data, options); > > </script> > > Thanks, > Amar > > -- > 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/d/optout. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> - 978-394-1058 [email protected] <[email protected]> 5CC, Cambridge MA [email protected] <[email protected]> 9 Juniper Ridge Road, Acton MA -- 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/d/optout.
