本文整理了Java中com.github.mikephil.charting.highlight.Highlight.<init>()
方法的一些代码示例,展示了Highlight.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Highlight.<init>()
方法的具体详情如下:
包路径:com.github.mikephil.charting.highlight.Highlight
类名称:Highlight
方法名:<init>
[英]Constructor, only used for stacked-barchart.
[中]构造函数,仅用于堆叠条形图。
代码示例来源:origin: PhilJay/MPAndroidChart
/**
* Highlights the value at the given x-value in the given DataSet. Provide
* -1 as the dataSetIndex to undo all highlighting.
*
* @param x
* @param dataSetIndex
* @param stackIndex the index inside the stack - only relevant for stacked entries
*/
public void highlightValue(float x, int dataSetIndex, int stackIndex) {
highlightValue(new Highlight(x, dataSetIndex, stackIndex), false);
}
代码示例来源:origin: PhilJay/MPAndroidChart
/**
* Highlights any y-value at the given x-value in the given DataSet.
* Provide -1 as the dataSetIndex to undo all highlighting.
* @param x The x-value to highlight
* @param y The y-value to highlight. Supply `NaN` for "any"
* @param dataSetIndex The dataset index to search in
* @param callListener Should the listener be called for this change
*/
public void highlightValue(float x, float y, int dataSetIndex, boolean callListener) {
if (dataSetIndex < 0 || dataSetIndex >= mData.getDataSetCount()) {
highlightValue(null, callListener);
} else {
highlightValue(new Highlight(x, y, dataSetIndex), callListener);
}
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
protected Highlight getClosestHighlight(int index, float x, float y) {
IPieDataSet set = mChart.getData().getDataSet();
final Entry entry = set.getEntryForIndex(index);
return new Highlight(index, entry.getY(), x, y, 0, set.getAxisDependency());
}
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
protected List<Highlight> buildHighlights(IDataSet set, int dataSetIndex, float xVal, DataSet.Rounding rounding) {
ArrayList<Highlight> highlights = new ArrayList<>();
//noinspection unchecked
List<Entry> entries = set.getEntriesForXValue(xVal);
if (entries.size() == 0) {
// Try to find closest x-value and take all entries for that x-value
final Entry closest = set.getEntryForXValue(xVal, Float.NaN, rounding);
if (closest != null)
{
//noinspection unchecked
entries = set.getEntriesForXValue(closest.getX());
}
}
if (entries.size() == 0)
return highlights;
for (Entry e : entries) {
MPPointD pixels = mChart.getTransformer(
set.getAxisDependency()).getPixelForValues(e.getY(), e.getX());
highlights.add(new Highlight(
e.getX(), e.getY(),
(float) pixels.x, (float) pixels.y,
dataSetIndex, set.getAxisDependency()));
}
return highlights;
}
代码示例来源:origin: PhilJay/MPAndroidChart
set.getAxisDependency()).getPixelForValues(e.getX(), e.getY());
highlights.add(new Highlight(
e.getX(), e.getY(),
(float) pixels.x, (float) pixels.y,
代码示例来源:origin: PhilJay/MPAndroidChart
/**
* Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
* point
* inside the CombinedChart.
*
* @param x
* @param y
* @return
*/
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
if (mData == null) {
Log.e(LOG_TAG, "Can't select by touch. No data set.");
return null;
} else {
Highlight h = getHighlighter().getHighlight(x, y);
if (h == null || !isHighlightFullBarEnabled()) return h;
// For isHighlightFullBarEnabled, remove stackIndex
return new Highlight(h.getX(), h.getY(),
h.getXPx(), h.getYPx(),
h.getDataSetIndex(), -1, h.getAxis());
}
}
代码示例来源:origin: PhilJay/MPAndroidChart
/**
* Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
* point
* inside the BarChart.
*
* @param x
* @param y
* @return
*/
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {
if (mData == null) {
Log.e(LOG_TAG, "Can't select by touch. No data set.");
return null;
} else {
Highlight h = getHighlighter().getHighlight(x, y);
if (h == null || !isHighlightFullBarEnabled()) return h;
// For isHighlightFullBarEnabled, remove stackIndex
return new Highlight(h.getX(), h.getY(),
h.getXPx(), h.getYPx(),
h.getDataSetIndex(), -1, h.getAxis());
}
}
代码示例来源:origin: PhilJay/MPAndroidChart
sliceangle * index * phaseX + mChart.getRotationAngle(), pOut);
mHighlightBuffer.add(new Highlight(index, entry.getY(), pOut.x, pOut.y, i, dataSet.getAxisDependency()));
代码示例来源:origin: PhilJay/MPAndroidChart
Highlight stackedHigh = new Highlight(
entry.getX(),
entry.getY(),
代码示例来源:origin: com.github.PhilJay/MPAndroidChart
/**
* Highlights the value at the given x-value in the given DataSet. Provide
* -1 as the dataSetIndex to undo all highlighting.
*
* @param x
* @param dataSetIndex
* @param stackIndex the index inside the stack - only relevant for stacked entries
*/
public void highlightValue(float x, int dataSetIndex, int stackIndex) {
highlightValue(new Highlight(x, dataSetIndex, stackIndex), false);
}
代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart
/**
* Highlights the value at the given x-value in the given DataSet. Provide
* -1 as the dataSetIndex to undo all highlighting.
*
* @param x
* @param dataSetIndex
* @param stackIndex the index inside the stack - only relevant for stacked entries
*/
public void highlightValue(float x, int dataSetIndex, int stackIndex) {
highlightValue(new Highlight(x, dataSetIndex, stackIndex), false);
}
代码示例来源:origin: xiaolongonly/Ticket-Analysis
/**
* Highlights the value at the given x-value in the given DataSet. Provide
* -1 as the dataSetIndex to undo all highlighting.
*
* @param x
* @param dataSetIndex
* @param stackIndex the index inside the stack - only relevant for stacked entries
*/
public void highlightValue(float x, int dataSetIndex, int stackIndex) {
highlightValue(new Highlight(x, dataSetIndex, stackIndex), false);
}
代码示例来源:origin: WenWangAndroid/ChartManager
/**
* Highlights the value at the given x-value in the given DataSet. Provide
* -1 as the dataSetIndex to undo all highlighting.
*
* @param x
* @param dataSetIndex
* @param stackIndex the index inside the stack - only relevant for stacked entries
*/
public void highlightValue(float x, int dataSetIndex, int stackIndex) {
highlightValue(new Highlight(x, dataSetIndex, stackIndex), false);
}
代码示例来源:origin: com.github.PhilJay/MPAndroidChart
@Override
protected Highlight getClosestHighlight(int index, float x, float y) {
IPieDataSet set = mChart.getData().getDataSet();
final Entry entry = set.getEntryForIndex(index);
return new Highlight(index, entry.getY(), x, y, 0, set.getAxisDependency());
}
}
代码示例来源:origin: xiaolongonly/Ticket-Analysis
@Override
protected Highlight getClosestHighlight(int index, float x, float y) {
IPieDataSet set = mChart.getData().getDataSet();
final Entry entry = set.getEntryForIndex(index);
return new Highlight(index, entry.getY(), x, y, 0, set.getAxisDependency());
}
}
代码示例来源:origin: WenWangAndroid/ChartManager
@Override
protected Highlight getClosestHighlight(int index, float x, float y) {
IPieDataSet set = mChart.getData().getDataSet();
final Entry entry = set.getEntryForIndex(index);
return new Highlight(index, entry.getY(), x, y, 0, set.getAxisDependency());
}
}
代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart
@Override
public void onValueSelected(Entry e, Highlight h) {
barChart.highlightValue(h);
lineChart.highlightValue(new Highlight(h.getX(), h.getDataSetIndex(), -1));
if (mHighlightValueSelectedListener != null) {
mHighlightValueSelectedListener.onDayHighlightValueListener(mData, e.getXIndex(), true);
}
}
代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart
@Override
public void onValueSelected(Entry e, Highlight h) {
lineChart.highlightValue(h);
barChart.highlightValue(new Highlight(h.getX(), h.getDataSetIndex(), -1));
if (mHighlightValueSelectedListener != null) {
mHighlightValueSelectedListener.onDayHighlightValueListener(mData, e.getXIndex(), true);
}
}
代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart
@Override
public void onValueSelected(Entry e, Highlight h) {
lineChart.highlightValue(h);
barChart.highlightValue(new Highlight(h.getX(), h.getDataSetIndex(), -1));
if (mHighlightValueSelectedListener != null) {
mHighlightValueSelectedListener.onDayHighlightValueListener(mData, e.getXIndex(), true);
}
}
代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart
@Override
public void onValueSelected(Entry e, Highlight h) {
barChart.highlightValue(h);
Highlight highlight = new Highlight(h.getX(), 0, h.getStackIndex());
highlight.setDataIndex(1);
candleChart.highlightValues(new Highlight[]{highlight});
updateText(e.getXIndex(), true);
}
内容来源于网络,如有侵权,请联系作者删除!