Search in sources :

Example 1 with DataStoreSeries

use of com.android.tools.datastore.DataStoreSeries 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)

Aggregations

LegendComponent (com.android.tools.adtui.LegendComponent)1 LegendRenderData (com.android.tools.adtui.LegendRenderData)1 StateChart (com.android.tools.adtui.chart.StateChart)1 DataStoreSeries (com.android.tools.datastore.DataStoreSeries)1 JBColor (com.intellij.ui.JBColor)1 ArrayList (java.util.ArrayList)1