yAxis control for stacked bar chart - chart.js

I have been looking online and in the source code of Chart.js to find a way to use the stacked bar chart without stacking (summing) the values.
Example:
My data points are 1, 2, 2.5, 3, 4 for the stacked bar. The chart y axis by default will sum that up to 12.5 (standard stacked bar behaviour).
What I would like is that each stack only go to its literal value, not the summed value.
In the example above, I would expect stack 1 to go to 1 on the y, 2 to 2 and so on until 4.
Is this possible OTB? Or will I need to write a custom chart renderer to achieve the desired result.
Note: The sequences will always be in order, and never have duplicates.

Found the solution. I had set stacked on both x and y axes where all I needed to do was stack on the x axes.

Related

Not able to get actual values in decimal places in x axis of matplotlib plot in python [duplicate]

Could someone please guide me on how should I make sure that all ticks (or maybe a better way to specify will be to say all elements in the list passed to plot function) are displayed on the x axis when using matplotlib to plot graphs?
plt.plot(xValues, meanWeekdayArrivalCounts, 'k-')
I want all the values in the list xValues to show up on the graph. By default, only, 0, 10, 20, 30, 40, 50 show up.
Simply add plt.xticks(xValues) to your code. Given the number of points in your graph, the labels might clutter.
You could display them as minor ticks if you set them on the axes object with ax.set_xticks(xValues, minor=True).
use this.
fig = plt.figure(figsize=(10,8))
plt.xticks(np.arange(min(x), max(x)+1, 1.0))
I wanted to show all the years in my graph so I did
plt.xticks(list(table_05.anio.unique()))

(scaled) y value for given x value

I'm modifying some examples [1][2] to draw a line on the canvas. For the end-point I have calculated a data value but now I want to calculate the y value on the canvas.
In the examples I found
this.chart.chart.scale.getPixelForValue()
which seems deprecated in chart.js 2.6
// Used to get data value locations. Value can either be an index or a numerical value
getPixelForValue: helpers.noop,
The first example uses
this.calculatePointY()
but that doesn't help me either.
What would I use instead?
[Note]: This question is similar but has no answers: Get Y value of line from X pixel value in ChartJS 2
[1] https://stackoverflow.com/a/39118152
[2] https://stackoverflow.com/a/37222238
For ChartJS - version 2.6, you should use the following ...
chart.scales['y-axis-0'].getPixelForValue(<value>);

Chart.js place y value position and its x-label position relative to the x-value

Is it possible for me to supply a chart.js chart with a list of Y values that have a corresponding label/X value and place them vertically and horizontally relative to their own value.
For example: I have a list of values at a certain time (unix timestamp) that I want to show on a chart, with its Y value positioned relative, but also its horizontal position and its label relative on the x-scale.
At this moment it always spaces out my labels, completely over the entire x axis, at equal distances, without taking into account the values of the labels itself. Is there way to automatically accomplish this with chart.js ?
A line or scatter chart will do the job. The main criteria is that the data is a series of x and y coordinates. Each point in the array is in the form:
{
x: xValue,
y: yValue
}
See http://www.chartjs.org/samples/latest/charts/scatter/basic.html
here is a jsfiddle that reproduces your image.

Google Charts not displaying correctly

I am generating a URL that needs to create a PNG Graph, using Google Charts API.
I thought that I had all the parameters in the right position however the graph is not displaying correctly? It is only displaying one of the series, and even then, the series data is wrong.
If anyone can point me in the right direction, it would be much appreciated!
http://chart.apis.google.com/chart?
cht=lc&chs=800x350& // CHART SIZE
chco=6a6572,6a6572,6a6572,6a6572& // SERIES COLOURS
chxr=1,-11519.670000,19297.010000& // Y AXIS RANGE
chxt=x,y& // X & Y AXIS
chxl=0:|January%2017|February%2017|March%2017|April%2017|May%2017& // X AXIS VALUES
chdl=A|B|C|D& // SERIES NAMES
chtt=Sales+Year+To+DateYYYY& // CHART TITLE
chts=000000,24& // CHART COLOR AND FONT SIZE
chd=t:6032,13921,0,1263,19297|-1330,-11520,-4410,490,-361|298,798,285,228,108|884,1651,1161,1473,961
// SERIES VALUES
I finally figured it out. For some reason the series values parameters were taking a percentage value? So once I converted the values to a percentage of the total, it displayed fine.

Reverse y axis and bars in MS Chart

I am trying to reverse the Y Axis in MSChart
The scale from left to right would be 5 - 1
So if a bar has a value of 2 it will fill from 5 until 2 on the scale with the score to the right of the filled bar.
This link shows exactly what I am trying to achieve
http://www.hfi.com/images/graph.png
Is this possible with MS Chart?
Thanks
Have you tried using IsReversed property on the Y axis.