How to configure the no of ticks on nvd3 line chart axis.
I know that we can have no of tick count on d3 chart using following
var axis = d3.svg.axis().ticks([NO_of_Tick]).scale(widthscale);
How this can be done for nvd3 line chart.
If you want to show all your xAxis tick values by default try using :
nv.models.multiBarChart().reduceXTicks(false);
Or if you want to show only certain tick values on your xAxis you could try this:
// Assuming your xAxis has 1-10
chart.xAxis.tickValues([1,2,3,4,5,6,7,8,9,10])
Hope it helps.
Related
I made recently a Scatter chart, basically a simple line, but where I could define the data on both axis, Y and X.
Now I need to do the same but with a bar chart, and for what I am seeing, I Can only put labels on the X-axis in a bar chart, is there a way to actual put data on both axis?
In my scatter type chart I had the data as array of [{y: .., x: ..}]
Any way to achieve this in a bar chart? thank you
I have a bar type chart in chart.js with some columns and i want to draw a straight horizontal line at some point to the chart overt the bar columns.
I've tried to add a simple line type chart with equal point, but the problem is, the line doesn't start from X axis. The points are centered because of bar chart categories, but i want the line to be started from X axis.
Is there a way to do this?
I've done it by adding a second hidden X axis and i use that for the line chart.
I am using the d3.svg.axis() function in order to draw the x axis of my barchart. As the labels on the axis can be very long, I need to cut them (to let's say four letters) and display the rest as tooltip. I would like to make use of svg:title, as the browser will take care of displaying the tooltip then.
Any idea how I can achieve this? How can I add a title element on each label on the x axis ticks?
Many Thanks!
Should be as simple as:
// tooltip
d3.selectAll('.x.axis>.tick') // gs for all ticks
.append('title') // append title with text
.text(function(d){
return d;
});
Example here.
I want to display custom text as y axis label.
I have attached the sample screenshot.
Have you tried something like this?
var yAxis = new Rickshaw.Graph.Axis.Y({
graph: graph,
tickFormat: Rickshaw.Fixtures.Number.formatKMBT
});
yAxis.render();
working on high charts. Need to update dual x axis, but only one data sereies has to scale and on tool tip has to show dual x axis values with legends.