Comments (10)
hey @plouc, any news related to linear gradients in an area?
from nivo.
Started something for the gradient support => http://nivo.rocks/#/guides/gradients, but it's not available for line chart for now, just on Stream.
from nivo.
Area support has been added to line chart #82
from nivo.
For now it's not, charts use colors range for the sake of simple use.
from nivo.
with pie chart ? @plouc
from nivo.
up
from nivo.
Hi, the gradient on line chart area is not working
<Line
data={data}
width={700}
height={310}
xScale={{ type: 'point' }}
yScale={{ type: 'linear', stacked: false, min: 0, max: 400 }}
curve="linear"
axisTop={null}
axisRight={null}
axisBottom={null}
axisLeft={null}
enableGridX={false}
enableGridY={false}
colors={d => d.color}
enablePoints={false}
enableSlices="x"
enableArea={true}
areaBlendMode="screen"
areaOpacity={0.16}
keys={['react', 'vue', 'elm']}
defs={[{
id: 'gradientC',
type: 'linearGradient',
colors: [
{ offset: 0, color: '#fff' },
{ offset: 100, color: '#000' },
],
},]}
fill={[
{ match: '*', id: 'gradientC' },
]}
useMesh={true}
/>
Above is my code, the gradient is not being rendered whatsoever.
I also tried the example in the docs, and still no gradient shows
<Line
data={data}
width={700}
height={310}
margin={{ top: 0, right: 0, bottom: 0, left: 0 }}
xScale={{ type: 'point' }}
yScale={{ type: 'linear', stacked: false, min: 0, max: 400 }}
curve="linear"
axisTop={null}
axisRight={null}
axisBottom={null}
axisLeft={null}
enableGridX={false}
enableGridY={false}
keys={['react', 'vue', 'elm']}
// 1. defining gradients
defs={[
// using helpers
// will inherit colors from current element
linearGradientDef('gradientA', [
{ offset: 0, color: 'inherit' },
{ offset: 100, color: 'inherit', opacity: 0 },
]),
linearGradientDef('gradientB', [
{ offset: 0, color: '#000' },
{ offset: 100, color: 'inherit' },
]),
// using plain object
{
id: 'gradientC',
type: 'linearGradient',
colors: [
{ offset: 0, color: '#faf047' },
{ offset: 100, color: '#e4b400' },
]
} ]}
// 2. defining rules to apply those gradients
fill={[
// match using object query
{ match: { id: 'react' }, id: 'gradientA' },
// match using function
{ match: d => d.id === 'vue', id: 'gradientB' },
// match all, will only affect 'elm', because once a rule match,
// others are skipped, so now it acts as a fallback
{ match: '*', id: 'gradientC' },
]}
/>
from nivo.
There is an opened PR which seems to solve this issue.
from nivo.
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
from nivo.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!
from nivo.
Related Issues (20)
- π©Custom Legend causes infinite re-render! π© HOT 1
- Nivo Bar Chart: Incorrect Decimal Rounding in Labels
- Line Chart : crash when hovering an empty chart that is interactive HOT 1
- onMouseEnter and onMouseLeave don't work on @nivo/geo HOT 1
- The arc link labels for ResponsivePie overflow the drawable area. HOT 2
- Vite (using ESBuild) fails with 'require() of ES Module not supported' HOT 7
- @nivo/calendar type CalendarDatum is missing 'data' property
- There is no way to add border around the bar chart
- Choropleth: Support fill color by value or label
- Add support for forwardRef to allow exporting of images, (Sankey chart)
- [ Heatmap ] Warning in console while using Legend for heatmap HOT 1
- @nivo/line warnings when using Nivo >= 0.87.0 line chart HOT 3
- Nivo/line, stack line does not match the values in the graph. HOT 3
- Wrong `PointMouseHandler` type on event handlers like `onMouseMove` HOT 1
- Nivo Sankey Chart adjustable node thickness HOT 2
- React 19 Support HOT 4
- @nivo/bump chart is missing properties HOT 3
- Nivo calendar zero value color
- Add Repobeats (metrics) to README
- Pie Chart tooltip not showing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nivo.