question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: A way to add shadow to charts

See original GitHub issue

I’m submitting a … (check one with “x”)

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here

Current behavior Currently, there’s no way to add shadow to charts.

Expected behavior A component that creates shadow to charts and add shadows attribute in the usage chart template.

Please let me know if this looks fine to you. I’ll create a PR for this.

Please tell us about your environment:

  • OS - MAC
  • IDE - Code
  • NPM
  • Node
  • ngx-charts version: x.x.x 5.0.0

  • Angular version: 2.x.x 4.0.1

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] Chrome

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
Hypercubedcommented, Apr 20, 2017

@richavyas The filter definition doesn’t need to be in the same SVG. One way we could do it is to add a ngx-charts-svg-shadow component, like you have suggested, then use classes for each chart to apply shadow.

For the user it could look like this:

<ngx-charts-svg-shadow
</ngx-charts-svg-shadow>
<!-- defines the shadow globally for the page, only needed once -->

<ngx-charts-bar-horizontal
  class="svg-shadow-filter" ... >
</ngx-charts-bar-horizontal>

The ngx-charts-svg-shadow component and CSS class will have to be defined in ngx-charts. I foresee some issue with IDs, since they need to be unique. If you add any attributes to ngx-charts-svg-shadow-filter how do you ensure the CSS references to the correct url(#id)?

An alternative, and perhaps the most flexible, allowing users to define their own filters. This could look something like:

<svg>
  <defs>
    <filter id="someUniqueId" #myShadowFilter ... />
       ...
    </filter>
  </defs>
</svg>

<ngx-charts-bar-vertical
  [barFilter]="myShadowFilter" ... > <!-- references the filter by template reference or id -->
</ngx-charts-bar-vertical>

Might be interesting to explore creating declarative components for SVG filter definitions in ngx-charts to hide some of the complexity and ensure unique IDs. Perhaps looking like this:

<ngx-charts-svg-shadow
  #myShadowFilter
  [color]="color"
  [dx]="dx"
  [dy]="dy" ...>
</ngx-charts-svg-shadow>

<ngx-charts-bar-vertical
  [barFilterRef]="myShadowFilter" ... >
</ngx-charts-bar-vertical>

This is all suggestions. Any thoughts?

1reaction
Hypercubedcommented, Apr 19, 2017

Hi @richavyas , this can be done using a SVG filter definition and css. I’m not sure about the browser compatibility. Here is an example in plnkr:

https://plnkr.co/edit/isOUub?p=preview

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add drop shadows to bars - Visual Mining
How to add drop shadows to bars. Maybe you have a chart template such as a BarChart or ComboChart that uses the old...
Read more >
Drop shadow feature request - Microsoft Power BI Community
Hi Team, I want to request a drop shadow feature for the border of graphs. Ideally, it would allow for: * color of...
Read more >
Wow, Power BI SHADOW effect FEATURE REVIEW! How to ...
With the release of Shadows in the May 2020 Power BI desktop update, we take you through applying this feature to your visuals!...
Read more >
How to Add Shadows to a Line Chart in Chart JS - YouTube
How to Add Shadows to a Line Chart in Chart JSAdding shadows and blur effect on line chart in Chart JS can be...
Read more >
Add Shadows to Shapes and Objects - Lucidchart Help
It is not currently possible to add shadows to lines. However, if this functionality would be useful for you, please let us know...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found