I have plotted a Google Line chart which is showing X axis values in alternating up down format when having more values as shown below.
But I want to show it in a single line in a much better representation than the current one, a slope representation would also be fine like below.
My code for plotting the chart is as below:
var options = {
width: '100%',
height: '100%',
legend: ({ position: 'top', maxLines: 1, alignment: 'end'}),
chartArea: { left: "8%", right: "8%", top: "10%", width: "100%", height: "75%" },
backgroundColor: 'transparent',
tooltip: { textStyle: { color: 'black' }, isHtml: true },
curveType: 'none',
};
var chart = new google.visualization.LineChart($('Div')[0]);
chart.draw(view, options);
Is there any specific option that I have to apply to make the axis display in the required format?
see the configuration options for
hAxis
for a slope representation, use -->
slantedText: true
to enforce one level of labels, use -->
maxAlternation: 1
to keep the labels from wrapping on two lines, use -->
maxTextLines: 1
note: you may need to adjust
chartArea.bottom
to allow more room along the x-axis...see following working snippet...