> function brush() {
> x.domain(brush.empty() ? x2.domain() : brush.extent());
> focus.select("path").attr("d", area);
This is where your problem is. Firstly, focus.select("path") simply
selects the first <path> child of focus. You want to select more than
one path. However, focus.selectAll("path") will select all <path>
children, including those in the axes. So you'll want to restrict the
selection to the large line paths. To do this, simply give them a class
when they are added e.g.
// Appends the large chart
focus.append("path")
.data([data])
.attr("class", "large")
// …
Then updating the paths will be:
focus.selectAll("path.large").attr("d", area);
--
Jason Davies, http://www.jasondavies.com/
The axis component doesn't draw lines; it draws axes. Are you trying
to draw multiple lines with the same axis? Or multiple lines with
different axes? If you want to draw multiple lines, create multiple
path elements. If you want to draw multiple axes, create multiple g
elements and create a d3.svg.axis for each (or reuse the same axis but
change the configuration, as in the ggplot2-style examples).
> I tried Giorgios example but used 2 of the stocks(IBM and MSFT) from the
> stocks.csv instead....
> and what I saw on the screen were 2 lines that were intersecting in X
> shape....:(
Without a link to your example I can't say what's going wrong. Are you
trying to draw small multiples? If you have multiple lines on the same
chart (and the same axis), it's normal for them to intersect.
Mike
No, that's part of the API.
> I'm doing that currently, though I have one issue. I always like to bold
> the line where y = 0, but there doesn't appear to be a mechanism for this.
You can post select the created lines, use filter to select the
0-line, and then change the style. For example:
svg.append("g")
.attr("class", "x axis")
.call(xAxis)
.selectAll("line.tick")
.filter(function(d) { return !d; })
.style("stroke-width", "2px");
You could likewise add a class to the parent g element for that tick,
rather than selecting the line directly, which would let you then
apply stroke styles and font size changes via stylesheet.
> I believe I have to branch d3 in oder to add month end dates to the axis
> component (optional of course), so maybe I'll do the additions to the axis
> while I'm working.
You should be able to do that by overriding the tickFormat on the axis.
Mike