Individual Y axis domain in multiple charts in D3 - csv

I will create multiple charts from one CSV-file using D3. I want the the Y axis du update in each chart. Now the y axis is the same for all charts. It is set by the maximum value in the whole number1 column, and not for each chart created with d3.nest.
How can i make the Y axis fit to the number1 data in each chart?
What is wrong with the code? JSbin
This is my CSV-data:
name,year,number1,number2,number3
Superman,2003,227141296,214978953,212418250 <-- number1 should be max for Superman chart
Superman,2004,232769230,220606887,211301729
Superman,2005,192769230,220606887,211301729
Batman,2003,252873171,239836381,225174161 <-- number1 should be max for Batman chart
Batman,2004,286137492,262439880,243001175
Batman,2004,232769230,220606887,211301729
Spiderman,2006,809584667,279490239,248758932 <-- number1 is now max in every chart
Spiderman,2007,324081833,278022620,246734614
Spiderman,2008,294081833,278022620,246734614

I've bumped your bin to here. Essentially, I added three divs and svgs using the d3.selectAll.data(heroes).enter();pattern. I then used the forEach to add in the axis's and line to each div / svg by passing in each element of the array in the object you created. Note that for some reason, jsbin isn't appending the first of the svg elements.
The maxNumber values was then passed to the y-axis constructor inside the foreach loop as were the year / number1 (x/y) values. The x/y values were passed to a single line generator, instead of the three separate line functions, making things a bit tidier.
Anyhow, hope this helps.

Related

Specific X-Value labels for SSRS scatter plot

I am trying to reproduce this graph
I am having issues setting the x-axis to be the values 1,8,30,50,100,150,200.
I also have no idea how I can get the secondary y-axis to have labels at the defined x-axis.
I took the SQL and created another column called CallOutPoints which just did a simple IIF(X NOT IN (1,8,30,50,100,150,200) then NULL. I then added this but I still can't get the x-axis or y-axis intervals/labels to match what I am after.
My attempt you can see the blue markers which are my calloutpoints, I just want the x-axis to only show ticks at each non-null calloutpoints value and the secondary-y axis to have tickmarks at every non-null calloutpoint.
FRACTION = Red markers
CallOutPoints = Blue Markers

To limit the plot of a 'fit' function

As you see I am new to stackoverflow and Gnuplot, so please forgive me if I am not asking in the right way or right place ! :-
I have a scatter of (Y) data values/points collected over a range of dates. I can plot them against an x-axis of the dates and I have a 'fit' function of the form f(x)= a*x+b.
My problem is that this function extends/plots beyond the date range of the data points if I plot the data in a window which has a date range beyond that of the collected data. ie. the plotted function fills the whole window.
In other words : I want a window space (xrange) over say 50days but while the data is being collected (a few days only) I want the fitted function to occupy only the region of the so-far collected data and to then extend in sync with it as more data is plotted later.
Am I making sense !
Showing the unwanted
Thanks for any help.
Add a separate range for the fit line:
set xrange [10:50] # applies to the entire plot
plot 'data' using 1:2 with points title "Data", \
[12:25] fit(x) with lines title "fit"

Double scale for CSV data in gnuplot

I would like to plot CSV data, and refer them with two x-axes. On the bottom linear (4*$1^2) scale, and on the top - logarithmic scale in other units ($1). Both scales should refer to the same plot.
plot "sum_no_realloc.csv" using ($1*$1*4):4 with lines,
So the bottom scale should be in 4*$1^2 units, and the top should be in $1 units.
Use the link command.
Suppose that your data file looks like this:
3 1
4 2
10 3
20 4
and you want to plot as you described. The x2 axis needs to show the x-coordinates and the x1 axis needs to show the transformed coordinates.
Issue the following commands:
set link x2 via sqrt(x/4.0) inverse 4.0*x*x
set x2tics
Then if you plot by
plot "datafile.txt" using ($1*$1*4.0):2 with lines
You will see that the x2 axis runs from 0 to 20 and the x1 axis runs from 0 to 1600 (4*20*20). The link command forces the two axes to be linked based on a mapping function. You need to specify how the x2 axis is determined from the x1 axis and how to go the other way around as well - gnuplot will usually throw a warning message when you do this about not being able to confirm the mapping.
The following plot shows the results (I labeled the axes using the normal set xlab and set x2lab commands).

Flex bar chart plotting a single item on Y axis for two different items with same yField items

I have created a bar chart with single series item. xField of my series is "MEASURE" and yField is "ITEM_DESC".
Now my dataSource to the chart has got two data items:
item[0]: MEASURE = 100 and ITEM_DESC = MyItem
item[1]: MEASURE = 200 and ITEM_DESC = MyItem
When this bar chart is plotted, I see two nodes at Y Axis but graph is rendered on top of each other. So effectively I see two Y Axis nodes but only one bar with two data points. I understand bar chart is finding it difficult to differentiate between two same Y Axis items but is there a way I can plot two different bars in this situation?
All suggestions are welcome!
One series of items shall be a 'function' - for each 'x' value you can have only one 'y' value.
In this situation you can place those items to different series and then set ColumnChart's 'type' property to one of the "clustered|overlaid|stacked|100%" to specify how your two items shall be combined.
Otherwise, you can calculate custom positions for your items and implement your own itemrenderer that ignores values received in move() and setActualSize() methods and uses your custom positions instead.

SSRS chart does not show y-axis data labels when values are very small (<1)

I have chart that plots values of Y-axis less than 1 (0.1, 0.24, etc).
When the chart is built, Y-axis label just shows 0 at the origin and no other values along the axis.
My solution was a little ugly. Data series labels show up with the correct % signs, but the % signs do not show up on the Y axis.
Y axis: set Y axis range from 1-100 (or 1-120 so there is room to display the data labels that say 100%) Make sure you set your tick marks to Auto or a number between 1 and 100, otherwise you'll get one long bar of tick marks running all the way up the y axis.
Data series: on the series tab, change your Value Field formula to multiply your data series by 100.
Data series labels: on the series data label properties window > general tab, copy the formula from your data series Value Field into the Label Data value field. round it to 0 decimal points and add &"%" to the end to concatenate a percent to the end of it.
That way the right numbers display for my data series and my Y axis, but the % just doesn't show up on the Y axis. not perfect yet. and too much work.
I just tested this and it seems this happens in SSRS 2005 and not 2008. You can fix this by right clicking on your chart and going to properties. It should bring up the full Chart Properties, go to the Y Axis tab and set Major Gridlines at a value like .25/.5 or whatever you want.