Share different values on same tooltip in dc.js - dc.js

Is it possible to show a tooltip with all the same x values of a composite chart? I mean, if we have a JSON with
{"date":"1/18/2001", "Open":54.77, "High":56.19, "Low": 52.63, "Close": 55.50}
show something like this:

If the same data is used for all the parts of the composite chart (i.e. same group but different valueAccessors, you can use compositeChart.shareTitle(true) to pass the same title accessor down to all the child charts.
This works well if you're reducing multiple values into an object like your example.
Then you just need to set baseMixin.title to display all the parts with newlines.

Related

Multiple D3 charts on one page with data binding

I would like to have a JSON data structure that contains time series data for multiple charts (one or more lines per chart) and have this data bound dynamically to D3 so that I only need to specify the template for a single chart and then D3 handles creating the entire grid of charts for me according to some layout that I specify. When the underlying data structure is updated, series automatically get added or removed from existing charts or whole charts get added or removed.
I've seen this example that describes how to place multiple charts on a single page, but in the example code has to be written separately for each chart, whereas I am trying to create multiple charts dynamically.

How to make a world map with clickable countries in AMcharts?

Google maps is a bit of a nightmare in terms of getting GEOjson polygons for every country on a map, making them clickable, etc.
I came across AMcharts and it looks like a dream come true. Is there a way in AMcharts to make a world map that allows you to:
•select multiple countries at once,
•have click events for each country,
•displays the country's text on the map?
EDIT: I am using Angular 2.
have click events for each country
You can use listeners in the configuration object to bind an event while using Angular. Then use clickMapObject event to capture the click on a country.
You can get the map object from the event.
"listeners": [{
"event": "clickMapObject",
"method": function(e) {
var mapObject = e.mapObject;
}
}]
select multiple countries at once
You can implement the multi-selection using the event above. Check the example here:
https://codepen.io/team/amcharts/pen/864a70d0dc7140cb09ca507229166a11
displays the country's text on the map?
The country name is displayed on the tooltip. I recommend to use that instead of having the names displayed on the map, as many of them would overlap.

How to filter a dataTable in dc.js without affecting other dimensions

So for a while I had struggled with how to filter a dataTable in dc.js without affecting other dimensions. This seems counter-intuitive, as it goes against what crossfilter(the data filter behind dc.js) does best, but I'll explain why this can be relevant.
Suppose I have a dataset of peoples name age and gender. In one of my datatables, I only want to display males; using one crossfilter, I would be forced to filter all my other datatables by males.
Suppose I also have a pie chart that lists the first letter of each person's name, and I want to be able to filter on the 'M's. I have a table for males, and a table for females. I don't want these tables to affect the distribution of the pie chart, but I want to be able to click on the pie chart and have it filter the dc.js datatables. More or a less a one way filter.
What is the way to achieve this?
dc.js datatables accept crossfilter dimensions. I got around the problem by extending the dimension as follows.
function preFilter(dim,okey,oval){
return{
top:function(x){
var a1 = dim.top(x).filter(function(v){
return v[okey] === oval;
});
return a1;
}
};
}
This worked well for me, I hope it can help others.

SSRS: How to aggregate columns into one in a bar chart

A,100
B,120
C,50
D,20
Plotting this in a Chart produces the correct result: it gives me a chart with 4 columns.
What i want however is to add all these values into one column and have the chart show only one as i will be adding more data series (via lookUp) that will show additional related data.
Can this be achieved?
You can modify the dataset of the report, by summing A,B,C and D instead of selecting each one on it's own.
Try changing the chart type to a stacked column chart

Crossfilter filter based on textbox

I would like to filter my data based on the input in a textbox. Is this possible? Something like this but with crossfilter.
Certainly possible with crossfilter, just create dimension objects from your raw data and then apply a filter by the input of the text box.
myDimension.filter(valueFromBox); // selects values who equal the value in the text box
Check out the API docs here.

Resources