Skip to content

Commit

Permalink
get scatterplots going, split out treemaps by index
Browse files Browse the repository at this point in the history
  • Loading branch information
Charity Hilton committed Apr 30, 2015
1 parent f1ee7e3 commit 94a0241
Show file tree
Hide file tree
Showing 13 changed files with 1,134 additions and 706 deletions.
2 changes: 1 addition & 1 deletion build/css/Heracles.min.css

Large diffs are not rendered by default.

49 changes: 20 additions & 29 deletions lib/ohdsi/jnj.chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@
};
var options = $.extend({}, defaults, options);

tooltipBuilder = line_defaultTooltip(options.xLabel || "x", options.xFormat, function (d) {
var tooltipBuilder = line_defaultTooltip(options.xLabel || "x", options.xFormat, function (d) {
return d[options.xValue];
},
options.yLabel || "y", options.yFormat,
Expand Down Expand Up @@ -1465,43 +1465,32 @@
}
y.range([height, 0]);

// create a line function that can convert data[] into x and y points

var line = d3.svg.line()
.x(function (d) {
var xPos = x(d[options.xValue]);
return xPos;
})
.y(function (d) {
var yPos = y(d[options.yValue]);
return yPos;
})
.interpolate(options.interpolate);

var vis = chart.append("g")
.attr("class", options.cssClass)
.attr("transform", "translate(" + (options.margin.left + yAxisLabelWidth + yAxisWidth) + "," + options.margin.top + ")");

var series = vis.selectAll(".series")
.data(data)
.enter()
.append("g")
.append("g");

var seriesLines = series.append("path")
.attr("class", "line")
.attr("d", function (d) {
return line(d.values.sort(function (a, b) {
return d3.ascending(a[options.xValue], b[options.xValue]);
}));
var seriesDots = series
.selectAll(".dot")
.data(function (series) {
return series.values;
})

if (options.colorBasedOnIndex) {

} else if (options.colors) {
seriesLines.style("stroke", function (d) {
return options.colors(d.name);
.enter()
.append("circle")
.attr("class", "dot")
.attr("r", 4)
.style("fill", function(d) {
return options.colors(d[options.seriesName]);
})
}
.attr("transform", function (d) {
var xVal = x(d[options.xValue]);
var yVal = y(d[options.yValue]);
return "translate(" + xVal + "," + yVal + ")";
});


if (options.showSeriesLabel) {
Expand Down Expand Up @@ -1670,7 +1659,9 @@
.style("text-anchor", "middle")
.attr("dy", ".79em")
.text(options.seriesLabel);
seriesLabelHeight = seriesLabel.node().getBBox().height + 10;
if (seriesLabelHeight = seriesLabel.node()) {
seriesLabelHeight = seriesLabel.node().getBBox().height + 10;
}
}

var trellisLabel;
Expand Down
2 changes: 1 addition & 1 deletion src/css/heracles.css
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ hr.path {
#condition_table tr {
cursor: pointer;
}
#treemap_container rect {
#treemap_container rect, #drug_treemap_container rect, #proc_treemap_container rect {
cursor: pointer;
}
th {
Expand Down
Loading

0 comments on commit 94a0241

Please sign in to comment.