Search in sources :

Example 1 with LegendRenderData

use of com.android.tools.adtui.LegendRenderData in project android by JetBrains.

the class NetworkRadioSegment method createComponentsList.

@Override
public void createComponentsList(@NotNull List<Animatable> animatables) {
    EnumMap<RadioState, Color> colorsMap = getRadioStateColor();
    EnumMap<RadioState, String> labelsMap = getRadioStateLabel();
    mRadioChart = new StateChart(colorsMap);
    mRadioChart.addSeries(new RangedSeries<>(myTimeCurrentRangeUs, new DataStoreSeries<>(mDataStore, SeriesDataType.NETWORK_RADIO)));
    mNetworkTypeChart = new StateChart<>(getNetworkTypeColor());
    mNetworkTypeChart.setRenderMode(StateChart.RenderMode.TEXT);
    mNetworkTypeChart.addSeries(new RangedSeries<>(myTimeCurrentRangeUs, new DataStoreSeries<>(mDataStore, SeriesDataType.NETWORK_TYPE)));
    List<LegendRenderData> legendRenderDataList = new ArrayList<>();
    for (RadioState state : RadioState.values()) {
        LegendRenderData renderData = new LegendRenderData(LegendRenderData.IconType.LINE, colorsMap.get(state), labelsMap.get(state));
        legendRenderDataList.add(renderData);
    }
    mLegendComponent = new LegendComponent(LegendComponent.Orientation.HORIZONTAL, 100);
    mLegendComponent.setLegendData(legendRenderDataList);
    animatables.add(mNetworkTypeChart);
    animatables.add(mRadioChart);
    animatables.add(mLegendComponent);
}
Also used : LegendRenderData(com.android.tools.adtui.LegendRenderData) JBColor(com.intellij.ui.JBColor) ArrayList(java.util.ArrayList) DataStoreSeries(com.android.tools.datastore.DataStoreSeries) LegendComponent(com.android.tools.adtui.LegendComponent) StateChart(com.android.tools.adtui.chart.StateChart)

Example 2 with LegendRenderData

use of com.android.tools.adtui.LegendRenderData in project android by JetBrains.

the class ThreadsSegment method initializeLegendComponent.

private void initializeLegendComponent() {
    List<LegendRenderData> legendRenderDataList = new ArrayList<>();
    // Running state
    legendRenderDataList.add(new LegendRenderData(LegendRenderData.IconType.BOX, getThreadStateColor().get(CpuProfiler.ThreadActivity.State.RUNNING), RUNNING_LABEL));
    // Sleeping state
    legendRenderDataList.add(new LegendRenderData(LegendRenderData.IconType.BOX, getThreadStateColor().get(CpuProfiler.ThreadActivity.State.SLEEPING), SLEEPING_LABEL));
    // Blocked state. TODO: support this state later if we actually should do so
    legendRenderDataList.add(new LegendRenderData(LegendRenderData.IconType.BOX, new JBColor(new Color(199, 65, 101), new Color(199, 65, 101)), BLOCKED_LABEL));
    mLegendComponent = new LegendComponent(LegendComponent.Orientation.HORIZONTAL, Integer.MAX_VALUE);
    mLegendComponent.setLegendData(legendRenderDataList);
}
Also used : LegendRenderData(com.android.tools.adtui.LegendRenderData) JBColor(com.intellij.ui.JBColor) LegendComponent(com.android.tools.adtui.LegendComponent) JBColor(com.intellij.ui.JBColor)

Example 3 with LegendRenderData

use of com.android.tools.adtui.LegendRenderData in project android by JetBrains.

the class NetworkRadioView method getLegendData.

@NotNull
private static List<LegendRenderData> getLegendData() {
    List<LegendRenderData> legendData = new ArrayList<>();
    for (RadioState state : RadioState.values()) {
        if (state == RadioState.NONE) {
            continue;
        } else if (state == RadioState.LOW) {
            // consider removing this state entirely.
            continue;
        }
        LegendRenderData renderData = new LegendRenderData(LegendRenderData.IconType.LINE, RADIO_STATE_COLOR.get(state), state.toString());
        legendData.add(renderData);
    }
    return legendData;
}
Also used : LegendRenderData(com.android.tools.adtui.LegendRenderData) ArrayList(java.util.ArrayList) RadioState(com.android.tools.profilers.network.NetworkRadioDataSeries.RadioState) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

LegendRenderData (com.android.tools.adtui.LegendRenderData)3 LegendComponent (com.android.tools.adtui.LegendComponent)2 JBColor (com.intellij.ui.JBColor)2 ArrayList (java.util.ArrayList)2 StateChart (com.android.tools.adtui.chart.StateChart)1 DataStoreSeries (com.android.tools.datastore.DataStoreSeries)1 RadioState (com.android.tools.profilers.network.NetworkRadioDataSeries.RadioState)1 NotNull (org.jetbrains.annotations.NotNull)1