d3fc | A collection of components that make it easy to build | Chart library
kandi X-RAY | d3fc Summary
kandi X-RAY | d3fc Summary
A collection of components that make it easy to build interactive charts with D3
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of d3fc
d3fc Key Features
d3fc Examples and Code Snippets
Community Discussions
Trending Discussions on d3fc
QUESTION
I am trying to add zoom to UK map with d3fc-label-layout. But when I zoom in the labels are shifted. As I understand I have to recalculate the positions with d3fc-label-layout every time the zoom is called, but not sure how to do this Here is a fiddle https://jsfiddle.net/benderlio/cyvqase5/11/
...ANSWER
Answered 2021-Mar-17 at 09:23I was able to sync the zoom of the points and text by applying a transform on the labels themselves instead of the circles and text items.
I recalculate the position from the projection and adjust according to the zoom transformation:
QUESTION
Created a simplified example of what I need. There are 50 items in the series. Each item has a vertical list of five +
symbols.
ANSWER
Answered 2020-Oct-24 at 10:38Firstly, scale.invert
is meant for when you have the pixel coordinate, but not the corresponding datum value. This is relevant when you are doing clicks on a screen, for example. In this case, it's not the right tool for the job. You already have access to datum
, so you just need to call scaleY(datum.close)
.
However, d3fc
uses canvas.translate()
to change the zero point to .mainvalue()
. Therefore, you cannot simply use scaleY(datum.close)
to get the y-coordinate of the close value. Instead of (x, y)
, each point you want to draw becomes (0, y(arrow) - y(d.close))
. So you need to change the logic to reflect this.
Needing to clean up after yourself with context.translate()
is a recipe for bugs, It's almost always better to avoid such things.
As a final note, I had some confusion about your getMarks
function. If you want to draw 5 arrows evenly distributed over your bar, you need to have a gap of 1/4th of the bar height. Think of it like trees on a street. If the trees at 10 feet apart and the street is 100 feet long, you'll have 11 trees, not 10. Because of this, I drew 6 plus signs, not 5, because otherwise it looked kind of off balance.
QUESTION
Let's take this example.
https://d3fc.io/examples/series-canvas-candlestick/
It defines X scale as a time scale.
...ANSWER
Answered 2020-Aug-27 at 17:16You supply your scales to the D3FC cartesian chart, which then couples these with the axes that it creates for you.
As mentioned in the documentation the chart exposes the properties of the X and Y axes with an x
and y
prefix. So, if you want to change the tick format for the X axis, which you would typically do via the tickFormat
property, you instead do the following:
QUESTION
I'm using d3fc+canvas to render candlesticks to a chart and change their fill color based on whether it's an up or down candle. The series generator looks like this
...ANSWER
Answered 2020-Apr-07 at 13:48Now this functionality has been released, the code should look like this -
QUESTION
I'm trying to achieve the effect of rescaling the d3fc cartesian chart when the user drags along the axes.
https://codepen.io/parliament718/pen/BaNQPXx
This is in d3v5, and I'm using d3-zoom to re-scale the axes using d3.event.transform
. However, in d3-drag there is no d3.event.transform
so I don't understand what the equivelant logic would be using just the mouse coordinates that d3-drag provides.
ANSWER
Answered 2020-Mar-01 at 06:59You can create another zoom behavior which only changes the Y domain. Then, in the drag handler, call the new behavior's scaleBy
on the plot area with a scale factor based on the drag event's delta Y:
QUESTION
In previous version of d3fc my code was using fc.util.seriesPointSnapXOnly
for snapping the crosshair.
This appears to be gone in the latest version of d3fc (or maybe I'm missing it in one of the standalone packages?).
I'm using the canvas implementation (annotationCanvasCrosshair
) and it seems to also be missing the "snap" function where it was previously used like so:
ANSWER
Answered 2020-Feb-12 at 07:09I understand you've raised the issue with d3fc github, therefore I'll assume you are aware that util/snap.js
is been deprecated.
Since this functionality unsupported now, it seems that the only feasible way to work around it will be to implement your own.
I took your pen and original snap.js code as starting point and applied the method outlined in Simple Crosshair example from the documentation.
I ended up having to add missing functions and their dependencies verbatim (surely you can refactor and package it up into a separate module):
QUESTION
I'm using d3fc with canvas rendering and I can succesfully render triangles like so:
...ANSWER
Answered 2020-Jan-21 at 06:27This looks very much like a bug in the canvas point series implementation. If you look at the source code, the path instructions are executed:
https://github.com/d3fc/d3fc/blob/master/packages/d3fc-series/src/canvas/point.js#L23
Following which, decorate is called:
https://github.com/d3fc/d3fc/blob/master/packages/d3fc-series/src/canvas/point.js#L28
As a result, decorate can modify the fill and stroke, but not modify the drawing functions in any way. This should be a simple fix.
QUESTION
I'm sorry if this is incredibly easy/basic, but I'm completely new to D3.js and I just want to get this example loaded so I can try to modify it with my own data.
I'm trying to replicate the following chart from the d3fc library: https://bl.ocks.org/ColinEberhardt/3ce92a3eef9f97ab4700868896414679
I created three different files as per the example:
...ANSWER
Answered 2019-May-16 at 17:14Just copy the whole code block and into your index.html file and the script in to the js file and include using the script src path. then declare the chart handler i.e
in your html file and pass to the d3.select function i.e d3.select("#chartIdHandle")
You can load the data.csv file within the same function
i.e d3.csv("file url")
in your if the file is in the local
directory you can just use d3.csv("/data.csv")
Give it a try.
First I changed all script url to https
QUESTION
I am trying to create a divergent bar chart, which shows the buy and sell volume on a particular date.
The graph has both zoom and brush working on it. I am having trouble selecting the whole bar when hovering/clicking on the orange(Sell) color bar, the Blue(Buy) color bar works on mouseover and click. I have created same class name for a stack but when I try to select the lower stack the stroke width does not change and same is the case with click. In both the functions, upper bar works but not the lower one. Also any suggestion on how to deactivate the click when an event is made on the body of the svg would be appreciated.
working image :
Problem:
Here is the code for the chart
...ANSWER
Answered 2017-Oct-25 at 13:45Your problem is in this code:
QUESTION
I'm trying to position labels on map overlapping-free by using using d3fc-label-label.js in combination with d3.js. While labeling the map by basic d3 functions works well, the approach with the help of d3fc-label-label.js (heavily inspired by this example) produces a map with all the labels placed in top left corner.
Here's the javascript part that does the job
...ANSWER
Answered 2017-Jul-14 at 18:28I believe the problem lies in the fact that you are not passing single coordinates as the label's position.
layoutLabel.position(accessor)Specifies the position for each item in the associated array. The accessor function is invoked exactly once per datum, and should return the position as an array of two values, [x, y].
In the example you show, that you are basing the design on, the variable places
contains point geometries, it is to these points that labels are appended. Looking in the topojson we find places
looking like:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install d3fc
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page