-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Single stacked bar chart #884
Comments
@subarroca I've talked to a couple of people in the past about such a component - so i feel this would be a good addition to the library. Initial thoughts & questions:
|
The primary challenge that we have faced in the past with this one, is that this needs to work in a connected manner (in table columns, for example). This works a little bit against our current system of coloring a chart, that's why we are still having trouble with this one. |
Maybe we need to leave this up to the developer to colorize the same metric in rows the same way. Auto coloring for simple usecases and for connected ones, colors need to be set on the series. |
<dt-single-stacked-bar
[series]="series"
[selected]="selected"
(selectedChange)="onSelect($event)"
valueDisplayMode="percent"
[visibleLegend]="false"
>
<div dtSingleStackedBarOverlay>...</div>
</dt-single-stacked-bar> inputs
outputs
content projection
modelsinterface DtSingleStackedBarNode {
label: string;
value: number;
color?: DtColors | string;
}
export enum DtChartValueMode {
ABSOLUTE = 'absolute',
PERCENT = 'percent',
} colors
legend
TBD
|
Hi @subarroca! Inputs
I think we should consider connecting the SingleStackedBarChart to the dt-legend and let the consumer define where the legend is going to be rendered. I'm thinking about the usecase of a SingleStackedBarChart within a table-row, where at the end of the table itself, it shows the legend for the chart. Models
Please use a union type of |
Hi @tomheller! I made some changes to the proposal to make it fit better. export type DtSingleStackedBarChartValueDisplayMode =
| 'none'
| 'absolute'
| 'percent'; Does this work for you or do you prefer not to have the type? Also I've added Colors are automatically fetched with the About the use of the legend. I've put that in the template. Do I need to connect it or expose the legend somehow? |
This works perfectly for me, 👍
This works for me as well, can you reflect the changes in your comment as well, so we have an up to date and single source here #884 (comment)
The point i was trying to make is, that multiple charts can share a single legend. That's why I don't think we can embed the legend within the chart itself, but need to do something like this. Imagine a table or any other sort of repeating data-representation, where the rows are semantically connected. <dt-dummy-table>
<dt-dummy-row *ngFor="let row of rows">
<dt-single-stacked-bar [series]="row.series" legend="dummyTableLegend">
</dt-single-stacked-bar>
</dt-dummy-row>
</dt-dummy-table>
<dt-single-stacked-bar-legend #dummyTableLegend>
<!-- ... ? -->
</dt-single-stacked-bar-legend> This way you would not want to render the legend within every row, but at the end of the table, collecting all series points and displaying their icons and labels. I hope this is understandable? |
Yes, totally understandable. I thought you wanted to interact with the legend and hide or show the elements in the chart. I'll update the definition in a while |
<dt-single-stacked-bar
[series]="series"
[selected]="selected"
(selectedChange)="onSelect($event)"
valueDisplayMode="percent"
[visibleLegend]="false"
>
<div dtSingleStackedBarOverlay>...</div>
</dt-single-stacked-bar> inputs
outputs
content projection
modelsinterface DtSingleStackedBarChartNode {
label: string;
value: number;
color?: DtColors | string;
}
export type DtSingleStackedBarChartValueDisplayMode =
| 'none'
| 'absolute'
| 'percent'; colors
legend
|
Maybe, if we think about connecting multiple ones of the single-stacked-bar-charts, something like a This and the external legend is probably not something we need to tackle right away, because I think this can be extended as an option afterwards without a breaking change. |
After the suggestions and considering that this component could be reusable for multiple series I decided to upgrade it and not call it <dt-stacked-bar
[series]="series"
[selectable]="selectable"
[(selected)]="selected"
[valueDisplayMode]="valueDisplayMode"
[direction]="direction"
[labelPosition]="labelPosition"
[legendPosition]="legendPosition"
[legends]="legends"
[fillMode]="fillMode"
[maxBarSize]="maxBarSize"
[max]="max"
>
<ng-template dtStackedBarChartOverlay let-tooltip>
<strong>{{ tooltip.seriesOrigin.label }}</strong>
<div>{{ tooltip.origin.label }}: {{ tooltip.origin.value }}</div>
</ng-template>
</dt-stacked-bar> inputs
outputs
content projection
modelsinterface DtStackedBarChartSeries {
label: string;
nodes: DtStackedBarChartNode[];
}
interface DtStackedBarChartNode {
label: string;
value: number;
color?: DtColors | string;
}
interface DtStackedBarChartTooltipData {
origin: DtStackedBarChartNode;
seriesOrigin: DtStackedBarChartSeries;
valueRelative: number;
color: DtColors | string;
visible: boolean;
selected: boolean;
length?: string;
}
type DtStackedBarChartValueDisplayMode = 'none' | 'absolute' | 'percent';
type DtStackedBarChartElementPosition =
| 'none'
| 'top'
| 'right'
| 'bottom'
| 'left';
type DtStackedBarChartFillMode = 'full' | 'relative';
type DtStackedBarChartDirection = 'horizontal' | 'vertical'; colors
legend
|
Hi @subarroca! Bar horizontal / vertical vs Bar chart & column chart selector direction Input labelPosition: DtStackedBarChartElementPosition legendPosition: DtStackedBarChartElementPosition maxBarSize: number Things to consider in the futureThe API proposal does not include anything about axis, axis labels, ticks and sizes. I guess that we can do that in an additional step later on. ConsiderationsAs this seems like a very large component, I guess it would be feasible to split this up and define a minimum viable product to get started with. Otherwise I see this one taking a fairly long time. What are your thoughts on this @ffriedl89 @subarroca ? |
Hi! First of all everything I suggested is already done so it would not take much time to do this except for testing Selector About the bar / column chart Label position Legend position maxBarSize Axis |
closed by #988 |
Feature Request
Summary
Horizontal stacked bar chart to display multiple values of the same group
Feature Description
Attachments
https://demo.dev.dynatracelabs.com/ui/user-sessions/-15832438029561I824BXYQV8TZOYSTZUSOXWK1WONTSJ6?gtf=2020-04%20to%202020-05&gf=all
The text was updated successfully, but these errors were encountered: