I'm submitting a ... (check one with "x")
ngx-charts tag) or the gitter chat for support questionsCurrent behavior
Line charts (as far as i could see) has only one default appearance for every line (continuous)
Expected behavior
Would be nice to be able to set line appearance to something like "dashed" or similar, bonus points for setting just a portion of the data as "dashed"
What is the motivation / use case for changing the behavior?
Have a better visual of the resulting chart, for example to recognize real values against estimated values.
Something like this: http://www.andypope.info/ngs/ng45.gif
It should also support different marker styles to overlay on the line, similar to matlab, matplotlib, etc. Ie, small dots, asterisks, plus, circle, box, etc etc.
It should also support a way to control the size of said markers, and the lines
is there any workaround?
you can make series dashed with stroke-dasharray property with css
but in order to have a series partly dashed and partly solid, you have to split series into multiple series i guess.
@comfortme thanks for the tip. I'm just looking to style a line completely as dashed, but if I have a series of 4 lines and need only one of them to be dashed which selector would I use to have stroke-dasharray applied to that specific line I want dashed?
I'd like to something like below, but I have no way (at least that I know of) to target the specific line.
And ideas?
Thanks!
<g class="line-series ng-tns-c20-23" ngx-charts-line="" ng-reflect-path="M263.2335061,401.7777777777777" ng-reflect-stroke="#3f51b5" ng-reflect-data="[object Object]" ng-reflect-animations="true">
<path class="line ng-trigger ng-trigger-animationState" stroke-width="1.5px" stroke="some-stroke-color" stroke-dasharray="4 1" ......>
</path>
</g>
hmm :nth-child maybe?
@jrhite Any update on this?
I used a combination of the two tips given to me above, stroke-dasharray property with nth-child by comfortme. It worked well.
// here 3 is the specific line I want to be dashed
g.line-chart > g:last-of-type > g:nth-child(3) g.line-series > path {
stroke: #72b4ec;
stroke-dasharray: 6 10;
}
@jrhite where did you put that css to change the line chart ?
I used a similar css approach for getting other shapes besides circles in the bubble chart, but it still feels very hacky (partially because we can't target these components with the component css, since it's outside the angular css scope). Seems like a very common requirement to be able to add a css class to lines or points in a series, seems like this could really be a powerful change that could enable a lot more chart flexibility-
https://github.com/swimlane/ngx-charts/issues/998#issuecomment-503569946
@lukekroon I had to put it in the global scss file, since otherwise it can't target these components outside of the angular component scope-
Any update on setting just a portion of the line data as "dashed"? or any workaround available for this task?
Most helpful comment
I used a combination of the two tips given to me above,
stroke-dasharrayproperty withnth-childby comfortme. It worked well.