本文整理匯總了Java中com.github.mikephil.charting.data.LineDataSet.enableDashedLine方法的典型用法代碼示例。如果您正苦於以下問題:Java LineDataSet.enableDashedLine方法的具體用法?Java LineDataSet.enableDashedLine怎麽用?Java LineDataSet.enableDashedLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.github.mikephil.charting.data.LineDataSet
的用法示例。
在下文中一共展示了LineDataSet.enableDashedLine方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addMainDataSets
import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
/**
* Adds the main data set for all times and the data set for the progression of record best
* times among all times. The progression of best times are marked in a different color to the
* main line of all time using circles lined with a dashed line. This will appear to connect
* the lowest troughs along the main line of all times.
*
* @param chartData The chart data to which to add the new data sets.
* @param allLabel The label of the all-times line.
* @param allColor The color of the all-times line.
* @param bestLabel The label of the best-times line.
* @param bestColor The color of the best-times line.
*/
private void addMainDataSets(LineData chartData, String allLabel, int allColor,
String bestLabel, int bestColor) {
// Main data set for all solve times.
chartData.addDataSet(createDataSet(allLabel, allColor));
// Data set to show the progression of best times along the main line of all times.
final LineDataSet bestDataSet = createDataSet(bestLabel, bestColor);
bestDataSet.enableDashedLine(3f, 6f, 0f);
bestDataSet.setDrawCircles(true);
bestDataSet.setCircleRadius(BEST_TIME_CIRCLE_RADIUS_DP);
bestDataSet.setCircleColor(bestColor);
bestDataSet.setDrawValues(false);
bestDataSet.setValueTextColor(bestColor);
bestDataSet.setValueTextSize(BEST_TIME_VALUES_TEXT_SIZE_DP);
bestDataSet.setValueFormatter(new TimeChartValueFormatter());
chartData.addDataSet(bestDataSet);
}
示例2: setData
import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private void setData(int count, float range) {
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count; i++) {
xVals.add((i) + "");
}
ArrayList<Entry> yVals = new ArrayList<Entry>();
for (int i = 0; i < count; i++) {
float mult = (range + 1);
float val = (float) (Math.random() * mult) + 3;// + (float)
// ((mult *
// 0.1) / 10);
yVals.add(new Entry(val, i));
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(yVals, "DataSet 1");
// set1.setFillAlpha(110);
// set1.setFillColor(Color.RED);
// set the line to be drawn like this "- - - - - -"
set1.enableDashedLine(10f, 5f, 0f);
set1.enableDashedHighlightLine(10f, 5f, 0f);
set1.setColor(Color.BLACK);
set1.setCircleColor(Color.BLACK);
set1.setLineWidth(1f);
set1.setCircleRadius(3f);
set1.setDrawCircleHole(false);
set1.setValueTextSize(9f);
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.fade_red);
set1.setFillDrawable(drawable);
set1.setDrawFilled(true);
ArrayList<ILineDataSet> dataSets = new ArrayList<ILineDataSet>();
dataSets.add(set1); // add the datasets
// create a data object with the datasets
LineData data = new LineData(xVals, dataSets);
// set data
mChart.setData(data);
}
示例3: dataSetConfig
import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
@Override
void dataSetConfig(IDataSet<Entry> dataSet, ReadableMap config) {
LineDataSet lineDataSet = (LineDataSet) dataSet;
ChartDataSetConfigUtils.commonConfig(lineDataSet, config);
ChartDataSetConfigUtils.commonBarLineScatterCandleBubbleConfig(lineDataSet, config);
ChartDataSetConfigUtils.commonLineScatterCandleRadarConfig(lineDataSet, config);
ChartDataSetConfigUtils.commonLineRadarConfig(lineDataSet, config);
// LineDataSet only config
if (BridgeUtils.validate(config, ReadableType.Number, "circleRadius")) {
lineDataSet.setCircleRadius((float) config.getDouble("circleRadius"));
}
if (BridgeUtils.validate(config, ReadableType.Boolean, "drawCircles")) {
lineDataSet.setDrawCircles(config.getBoolean("drawCircles"));
}
if (BridgeUtils.validate(config, ReadableType.Boolean, "drawCubic")) {
lineDataSet.setDrawCubic(config.getBoolean("drawCubic"));
}
if (BridgeUtils.validate(config, ReadableType.Number, "drawCubicIntensity")) {
lineDataSet.setCubicIntensity((float) config.getDouble("drawCubicIntensity"));
}
if (BridgeUtils.validate(config, ReadableType.String, "circleColor")) {
lineDataSet.setCircleColor(Color.parseColor(config.getString("circleColor")));
}
if (BridgeUtils.validate(config, ReadableType.Array, "circleColors")) {
lineDataSet.setCircleColors(BridgeUtils.parseColors(config.getArray("circleColors")));
}
if (BridgeUtils.validate(config, ReadableType.String, "circleColorHole")) {
lineDataSet.setCircleColorHole(Color.parseColor(config.getString("circleColorHole")));
}
if (BridgeUtils.validate(config, ReadableType.Boolean, "drawCircleHole")) {
lineDataSet.setDrawCircleHole(config.getBoolean("drawCircleHole"));
}
if (BridgeUtils.validate(config, ReadableType.Map, "dashedLine")) {
ReadableMap dashedLine = config.getMap("dashedLine");
float lineLength = 0;
float spaceLength = 0;
float phase = 0;
if (BridgeUtils.validate(dashedLine, ReadableType.Number, "lineLength")) {
lineLength = (float) dashedLine.getDouble("lineLength");
}
if (BridgeUtils.validate(dashedLine, ReadableType.Number, "spaceLength")) {
spaceLength = (float) dashedLine.getDouble("spaceLength");
}
if (BridgeUtils.validate(dashedLine, ReadableType.Number, "phase")) {
phase = (float) dashedLine.getDouble("phase");
}
lineDataSet.enableDashedLine(lineLength, spaceLength, phase);
}
}
示例4: getReactionTimeInPercentageLineData
import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
/**
* Get combined line data to be displayed in the line chart
*
* @return combined line data to be displayed in the line chart
*/
@NonNull
private LineData getReactionTimeInPercentageLineData() {
// get selected user
String userId = Global.getSelectedUser();
UtilsRG.debug("selected user!: " + userId);
// get percentage medians by user
final Double[] reactionTimesInPercentage = getReactionGameMedians(userId);
// get predicted median in percentage
final Double[] reactionTimesForecastInPercentage = getNextForecastReactionMedianInPercentage();
// fill reaction times
List<Entry> entries = new ArrayList<>();
for (int i = 0; i < reactionTimesInPercentage.length; i++) {
entries.add(new Entry(i, reactionTimesInPercentage[i].intValue()));
}
// fill forecast
List<Entry> entriesForecast = new ArrayList<>();
entriesForecast.add(new Entry(reactionTimesInPercentage.length - 1, reactionTimesInPercentage[reactionTimesInPercentage.length - 1].intValue()));
for (int i = 0; i < reactionTimesForecastInPercentage.length; i++) {
entriesForecast.add(new Entry(reactionTimesInPercentage.length + i, reactionTimesForecastInPercentage[i].intValue()));
}
// curved line
LineDataSet.Mode lineMode = LineDataSet.Mode.HORIZONTAL_BEZIER;
// reaction time in percentage data set
LineDataSet dataSet = new LineDataSet(entries, Strings.getStringByRId(R.string.forecast_performance));
dataSet.setMode(lineMode);
dataSet = setLineDataStyling(dataSet, R.color.colorPrimary);
// reaction time forecast in percentage data set
LineDataSet dataSetForecast = new LineDataSet(entriesForecast, Strings.getStringByRId(R.string.forecast_performance));
dataSetForecast.setMode(lineMode);
dataSetForecast = setLineDataStyling(dataSetForecast, R.color.colorPrimaryLight);
dataSetForecast.enableDashedLine(10, 10, 1000);
// combine data sets
LineData lineData = new LineData(dataSet, dataSetForecast);
lineData.setValueFormatter(new BarChartPercentFormatter());
lineData.setValueTextSize(15f);
return lineData;
}