Hi,
I need to tap on one of those legends (ex: Negative) and it should channel
in light of that feeling just, expecting just a red line have appeared and
all other dc diagram channels
<http://kosmiktechnologies.com/angularjs-training-hyderabad/> in view of
this. had a go at something like this on composite, however, couldn't hit
the nail on the head...
var dateDimension = cf.dimension(function (d) { if (d.dd) { return
d3.time.day(d.dd) } else { return d3.time.day() } });
var negativeSentimentGroup =
dateDimension.group().reduceSum(function (d) { return d.sentiment ===
'negative' ? 1 : 0; });
var positiveSentimentGroup =
dateDimension.group().reduceSum(function (d) { return d.sentiment ===
'positive' ? 1 : 0; });
var neutralSentimentGroup =
dateDimension.group().reduceSum(function (d) { return d.sentiment ===
'neutral' ? 1 : 0; });
var minDate = dateDimension.bottom(1)[0].dd;
minDate.setDate(minDate.getDate() - 1);
var maxDate = dateDimension.top(1)[0].dd;
maxDate.setDate(maxDate.getDate() + 1);
// Group comments count by date
var dateDimensionGroup =
dateDimension.group().reduceCount();
// Plot for Daily progress of comments
var sentimentSeriesChart =
dc.compositeChart("#sentiment-series", groupName);
sentimentSeriesChart.on('pretransition.hideshow', function (chart) {
chart.selectAll('g.dc-legend
.dc-legend-item')
.on('click.hideshow', function (d, i) {
$scope.lineChange(d.name);
});
});
var negativeSeriesChart =
dc.lineChart(sentimentSeriesChart).group(negativeSentimentGroup,
"Negative").colors('red');
var positiveSeriesChart =
dc.lineChart(sentimentSeriesChart).group(positiveSentimentGroup,
"Positive").colors('green');
var neutralSeriesChart =
dc.lineChart(sentimentSeriesChart).group(neutralSentimentGroup,
"Neutral").colors('orange');
var timeBarChart =
dc.barChart(sentimentSeriesChart).group(dateDimensionGroup).centerBar(true);
sentimentSeriesChart.width(1000)
.height(200)
.margins({ top: 10, right: 10, bottom: 60,
left: 40 })
.dimension(dateDimension)
.transitionDuration(500)
.brushOn(true)
.title(function (d) {
return chartingDateFormat(d.key) + ' :
' + d.value;
})
.legend(dc.legend().autoItemWidth(true).x(450).y(180).horizontal(true).itemHeight(16).gap(80).maxItems(3))
.renderHorizontalGridLines(true)
.compose([
negativeSeriesChart,
positiveSeriesChart,
neutralSeriesChart,
timeBarChart
])
.elasticY(true)
.yAxisLabel("No. of Comments")
.x(d3.time.scale().domain([minDate,
maxDate]))
.xUnits(function () { return 90; })
.xAxis().tickFormat(d3.time.format("%d/%m"));
// Set number of ticks
sentimentSeriesChart.yAxis().ticks(5);
In the above bit of code I'm ready to get the snap occasion on Legend (ex:
Negative) and on that I'm separating my dataset with just Negative remark
and the doing, cf.remove(); (where cf is cross-channel occurrence ) and
including the new sifted informational collection - cf.add(filterData); and
redrawing the entire dc assemble - dc.redraw(groupName);
By this I'm ready to channel the information however the date extend in
composite outline is demonstrating inaccurate,
Thanks and Regards,
Sireesha.
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.