In v2.0-beta, is there a way to configure the tooltip corresponding to that x-position to show up when hovering anywhere above that point on the axis? for example, the functionality shown here:
https://blockchain.info/charts/market-price
As you trace the line horizontally, you are shown the tooltip corresponding with your distance from the y-axis.
What the tooltip shows in your example is the y value corresponding to the distance from the y-axis (i.e. the x value).
Unless you want to extrapolate between data points (not usually a good idea for data like that shown in your example, since you don't know that its going to follow your extrapolation), this means that you need to have data values for all points where you want to show the tooltip.
With that your question is basically about showing every n x axis labels. https://stackoverflow.com/a/31606933/360067 does this similar for the current stable version of Chart.js. For v2.0-alpha, the option you need to be adjusting is scales.xAxes.labels.template.
Related
I have the following graph, and I want to rotate the X-axis labels in 40°, how can I do that?
PowerBI does not let you override the label orientation but rather adjusts it based on the space you allocate to the visual. Try making your visual a bit wider. For long labels, increase the maximum size of the X Axis on the settings to give more space to the labels and less to the bars. You can also tweak the padding and width settings to eek out a little more space. Also, consider abbreviating long labels.
Under the x-axis switch on the concatenated label. THis should do the trick for you
I went through the same issue/requirement but found no available configuration option for X axis labels. Labels are adjusted automatically based on number of BAR and width of the chart. Anyway, you can look on different options under "X-Axis" after changing the Type to "Categorical" as shown below-
I am creating project with ChartJs, and I am fetching real time data from the server. Each second, I add extra data point. After some time, there is just too many points on the graph, to the point that you cannot see anything. I would like to know, if there is a way to scroll through the x-variables, and always have set distance between the points? As of know, the distance between points is shrinking, making the graph not readable.
Thanks!
I would like to know, if there is a way to scroll through the
x-variables,
You can use .removeData( ) to remove the (current) first set of points. This would keep only the same number of (latest) points visible on the graph.
...and always have set distance between the points?
Unless you remove points maintain a set distance while adding points would cause the graph width to increase - which is usually not what you want to do.
I'm working on a piece of code to automatically align x-axis labels for a variable number of subplots. When I started having trouble setting label positions manually, I checked to be sure I could just transform from one set of coordinates to the other without changing anything, with a code snippet like this:
# xaxes is a list of Axes objects
textCoords = [ax.xaxis.get_label().get_position() for ax in xaxes]
newCoords = [ax.transAxes.inverted().transform(ax.xaxis.get_label().\
get_transform().transform(c)) for ax,c in zip(xaxes,textCoords)]
for ax,c in zip(xaxes,newCoords): ax.xaxis.set_label_coords(*c)
In theory, this code doesn't change any coordinates; it just gets the coordinates of each label, maps it to Axes coordinates using the Text object's internally-stored transform, and then sets the position. Yet running this code removes my labels entirely, and a little experimentation shows that they go off the bottom edge of the plot.
Have I just misunderstood the transforms involved here?
You're understanding the transforms correctly, but there's a caveat to using display coordinates before the plot has been displayed.
The short answer is that putting in a call to plt.draw() before your code snippet above will fix your immediate problem.
You're trying to link the different axes display system through display coordinates. However, before the plot has been drawn the first time, the renderer isn't fully initialized yet, and the display coordinates don't have much meaning.
Can you elaborate a bit more on what you're trying to do? There may be an easier way.
Alternatively, if you want to avoid the extra draw, you can link things through figure coordinates before the plot has been drawn. (They're well defined regardless.)
Each red circle in this map is a point but due to the density of them, there isn't enough space to show the text labels for all of them. So I want to filter them down to just show those which can show a text label.
How can I do this? marker-spacing seemed to be promising but makes no difference. I see no "marker-min-distance" as there is with "text-min-distance".
Basically there's no point in showing a marker at all if it can't be identified with text. This is for a non-interactive offline map.
There is marker-spacing.
If you want to draw only labelled markers, use shields instead (answered here).
Below is url that chart I am using.
http://chart.apis.google.com/chart?cht=lc&chco=99C754&chs=400x150&chds=20,1&chd=t:1.0,1.0,1.0,1.0,1.0&chxt=x,y&chxl=0:|12/07/09|12/14/09|12/21/09|12/28/09|01/04/10&1:1|10|20&chxr=1,20,0,10&chls=2&chg=25,100,1,2&chm=o,54C7C5,0,-1,5&chxtc=1,15|0,15
I want to start y-axis from 1 but in my chart is started from 0.
please help me
little look at google
show :
Axis Range chxr :
You can specify the
range of values that appear on each
axis independently, using the chxr
parameter. Note that this does not
change the scale of the chart
elements, only the scale of the axis
labels. If you want to make the axis
numbers describe the actual data
values, set and
to the lower and upper values of your
data format range, respectively. See
Axis Scaling for more information.
You must make an axis visible using
the chxt parameter if you want to
specify its range.
To specify custom axis values, use the
chxl parameter.
http://code.google.com/intl/iw/apis/chart/docs/gallery/bar_charts.html#axis_range