WIP: Improvement: D3 Line Chart Styles and Formatting #652
Reference in New Issue
Block a user
Delete Branch "enhancement/d3-line-chart-styles-and-formatting"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
closes #643
/claim #643
Functional Requirements
Currently, we have a
trendline_controller.jsand aline_chart_controller.js. We should consolidate these into a singleline_chart_controllerthat is configurable. Options will include:When the chart is supplied with a single value or an "empty" Time Series (i.e.
TimeSeries.new([])), it should display the "empty" state design.The chart controller will always receive a
TimeSeries.new([]).to_jsonvalue, which can be an instance ofMoneyor a regular integer (this is already implemented). As part of this issue, we need to make sure the chart can handle bothMoneyvalues and regular integers (including percentages) in the tooltip.Design Requirements
When the overall trend of the series that is passed to the line chart is "bad" (decreasing for an asset, increasing for a liability), the chart should go from a green color to a red color.
Ensure padding and spacing matches designs
When hovering over a data point in the chart, the line should highlight for dates prior to it, and the line after it should be grayed out
Implement gradient underneath the line (very subtle, see designs)
Refactor and improve overall styling
TimeSeries.new([]).to_jsonvalue, which can be an instance ofMoneyor a regular integer (this is already implemented). As part of this issue, we need to make sure the chart can handle bothMoneyvalues and regular integers (including percentages) in the tooltip.@zachgoll can you further explain this.
This basically just means that the D3 line chart should expect a
TimeSeriesdata type as input, and sinceTimeSeriescan hold multiple types of values (i.e. it can be a "money series" or just a "value series"), we need to make sure that our D3 chart can identify the value type and access the value properly.The design file shows both a "Money Series" and "Percentage Series" (savings rate) as examples, so as long as the D3 chart appropriately handles both of these you should be all set.
can you provide an example of percentage as where or how it will be used, there is a percent value in trend that will be the percent the chart will show and will it be like optional to make the chart pernctage one or if the percent value is not null it should make the chart parcentage?
@syedbarimanjan there is an example of a percent-based chart in the provided design file (last example) that shows how the tooltip and trend is displayed. To determine whether the chart displays a percentage value, I think we may want to add some sort of configuration option to the chart which tells it how to access and format the data points (this could also apply to
Moneyvalues).I meant a real example of it being used somewhere in the software. If it isnt at the moment can you specify where it will be used so i can try to implement it or just use it with some mock data which will help me better understand it.
Got it, understood now. We do not have an implementation of this yet in the UI. I'd recommend creating a small placeholder series somewhere in the UI to test it. Something like:
closing this in favour of #657
Pull request closed