How to reflect line type in legend in canvasjs - canvasjs

I have a graph of two lines, one of type solid, the other of type dashed, however the legend shows them both as solid. Is there a way to have the dashed line show up in the legend to accurately reflect what line matches what legend data?

Though this feature is currently not available, you can workaround this problem by setting legendMarkerType to "triangle" with color same as that of chart background. Here is a jsfiddle.
legendMarkerType: "triangle",
legendMarkerColor :"white",

Related

How to make a tooltip for a chart in d3?

We need to make it move like here.example The code is complex there, I can't figure it out.
I wrote the code my code, but I don’t understand how to make the tooltip move horizontally not behind the mouse, but near the nearest horizontal mark (as in the example)
It is not yet clear where the text above the bold text in the tooltip comes from. How to remove it so that it looks like in the picture?
How do I make the title of the tooltip match the label on the X-axis?
There are many ways to accomplish this. The way I typically do this is to create a series of SVG elements -- such as circles or rects -- using the same scale and data as the paths.
You can make these objects visible or invisible. Either way, you can attach mouseenter, mouseleave events to each to render and populate the tooltip.

How to align the x axis with the chart points in a dc.js ordinal line series chart? [duplicate]

I am trying to create a composite chart and my requirements are to draw a bar chart, a line chart and a dotted line chart. For that I draw a composite chart. Now I am having problem that points of line chart starts from start of bar chart, but I need that to start from center of line.
You can see the problem in this JSFiddle.
I got some help from Stackoverflow that is:
Align points in centre of bars (DC.JS composite chart)
Seems like a workaround is to assign ._rangeBandPadding(1) the composite chart. Though as mentioned in the github thread that breaks the bar sizes, so adding .gap(1) and .centerBar(true) to the bar chart got everything looking nice.
but after that I got this output
[http://jsfiddle.net/nauman3128/nr0rgzvc/9/][2]
I can't explain why this works, but with some odd combination of range bands and old-style .gap(1), I was able to get it to draw properly.
The trick is
._rangeBandPadding(1)
on the composite chart, and
.gap(1)
.centerBar(true)
on the child bar chart, pretty much as stated in the original question. So this is essentially a duplicate of the earlier question and answer, but I've applied it to your JSFiddle in this fork:
http://jsfiddle.net/gordonwoodhull/nr0rgzvc/22/
Also, it's important not to set barPadding for the child bar chart. So we are using range-band layout for the composite, and classic gap-padding for the bar chart, which sounds like a very bad idea... but the output looks okay!

NVD3 line chart - legend text cut off

I'm pretty new to D3 and NVD3. I'm playing with the line chart example which works great except for one thing: it cuts of the legend text as shown in the screen shot below. In the picture, it says "Mean Size Distributi..." instead for writing out Distribution.
Going through the source for NVD3s legend module, I can't seem to find a setter for the legend width. Any ideas?
chart.legend.maxKeyLength(100);
This will set maximum text length of legend as 100.

DC.js Composite chart Align points of Line chart in center of bars

I am trying to create a composite chart and my requirements are to draw a bar chart, a line chart and a dotted line chart. For that I draw a composite chart. Now I am having problem that points of line chart starts from start of bar chart, but I need that to start from center of line.
You can see the problem in this JSFiddle.
I got some help from Stackoverflow that is:
Align points in centre of bars (DC.JS composite chart)
Seems like a workaround is to assign ._rangeBandPadding(1) the composite chart. Though as mentioned in the github thread that breaks the bar sizes, so adding .gap(1) and .centerBar(true) to the bar chart got everything looking nice.
but after that I got this output
[http://jsfiddle.net/nauman3128/nr0rgzvc/9/][2]
I can't explain why this works, but with some odd combination of range bands and old-style .gap(1), I was able to get it to draw properly.
The trick is
._rangeBandPadding(1)
on the composite chart, and
.gap(1)
.centerBar(true)
on the child bar chart, pretty much as stated in the original question. So this is essentially a duplicate of the earlier question and answer, but I've applied it to your JSFiddle in this fork:
http://jsfiddle.net/gordonwoodhull/nr0rgzvc/22/
Also, it's important not to set barPadding for the child bar chart. So we are using range-band layout for the composite, and classic gap-padding for the bar chart, which sounds like a very bad idea... but the output looks okay!

How to Change Legend Type in Excel?

I have a line chart, where the chart legend also in forms of line. Is there a way I can change the legend type from colored line to colored circle or square?
Figure like this. http://www.nevron.com/gallery/FullGalleries/chartActiveX/stackline/images/StackLine1.png
I don't think you can use this method to get circles, but if you want to get squares, you can change the chart to a 3-D line chart, then right-click the chart area and select '3-D Rotation'. Change everything in the Rotation section of the menu to as close to 0 as you can get it. This will make your chart show up as a regular line chart while the legend shows little cubes. After you've done that, though, you'll probably have to change the axis settings. In my experience, 3D charts tend to show too many gridlines.

Resources