in application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/pages/itemhandler/ItemChart.java [169:247]
private void initializeChartAttributes(IState chartSettings) {
if (chartSettings == null) {
onShowAggregateInBarChart(Aggregators.count(), true);
} else {
String colorByAttribute = chartSettings.getAttribute(COLOR_BY);
if (colorByAttribute != null) {
colorBy = acc.getAllAttributes().get(colorByAttribute);
}
String lineChartAttributes = chartSettings.getAttribute(LINE_CHART_ATTRIBUTES);
if (lineChartAttributes != null) {
for (String a : lineChartAttributes.split(ATTRIBUTE_DELIMITER)) {
IAttribute<?> attribute = acc.getLineChartableAttributes().get(a);
showAttributeInLineChart(attribute, true);
}
}
String barChartAttributes = chartSettings.getAttribute(BAR_CHART_ATTRIBUTES);
if (barChartAttributes != null) {
for (String attrAggrString : barChartAttributes.split(ATTRIBUTE_DELIMITER)) {
IAggregator<?, ?> aggregator = null;
IAttribute<?> attribute = null;
String[] attrAggr = attrAggrString.split(AGGREGATOR_DELIMITER);
if (attrAggr.length >= 2) {
String attributeString = attrAggr[0];
String aggregatorString = attrAggr[1];
attribute = acc.getCommonChartableAttributes().get(attributeString);
if (attribute == null) {
attribute = acc.getUncommonChartableAttributes().get(attributeString);
}
if (attribute != null && attribute.getContentType() instanceof LinearKindOfQuantity) {
@SuppressWarnings("unchecked")
IAttribute<IQuantity> qAttribute = (IAttribute<IQuantity>) attribute;
aggregator = Aggregators.getQuantityAggregator(aggregatorString, qAttribute);
}
}
if (aggregator != null && attribute != null) {
showAttributeAggregateInBarChart(attribute, aggregator, true);
} else {
FlightRecorderUI.getDefault().getLogger().log(Level.WARNING,
"Unable to read in chart state, undefined attribute/aggregator tuple: " //$NON-NLS-1$
+ attrAggrString);
}
}
}
String barChartTypes = chartSettings.getAttribute(BAR_CHART_TYPES);
if (barChartTypes != null) {
for (String typeAggrString : barChartTypes.split(ATTRIBUTE_DELIMITER)) {
IAggregator<IQuantity, ?> aggregator = null;
IType<?> type = null;
String[] typeAggr = typeAggrString.split(AGGREGATOR_DELIMITER);
if (typeAggr.length >= 2) {
String typeString = typeAggr[0];
String aggregatorString = typeAggr[1];
type = acc.getAllTypes().get(typeString);
aggregator = Aggregators.getQuantityAggregator(aggregatorString, type);
}
if (aggregator != null) {
showTypeAggregateInBarChart(type, aggregator, true);
} else {
FlightRecorderUI.getDefault().getLogger().log(Level.WARNING,
"Unable to read in chart state, undefined type/aggregator tuple: " + typeAggrString); //$NON-NLS-1$
}
}
}
String barChartAggregators = chartSettings.getAttribute(BAR_CHART_AGGREGATES);
if (barChartAggregators != null) {
for (String aggrString : barChartAggregators.split(ATTRIBUTE_DELIMITER)) {
IAggregator<IQuantity, ?> aggregator = Aggregators.getQuantityAggregator(aggrString);
if (aggregator != null) {
showAggregateInBarChart(aggregator, true);
} else {
FlightRecorderUI.getDefault().getLogger().log(Level.WARNING,
"Unable to read in chart state, undefined aggregator tuple: " + aggrString); //$NON-NLS-1$
}
}
}
showSpanChart = StateToolkit.readBoolean(chartSettings, SHOW_GROUPING_AS_SPAN_CHART, false);
}
}