use of org.jfree.chart.plot.ValueMarker in project java-examples by urvanov-ru.
the class MyTestCustomizer method customize.
public void customize(JFreeChart chart, JRChart jasperChart) {
// Позиция, на которой
ValueMarker marker = new ValueMarker(6);
// рисуем линию
marker.setPaint(Color.BLUE);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.addRangeMarker(marker);
}
use of org.jfree.chart.plot.ValueMarker in project memory-map-plugin by Praqma.
the class MemoryMapBuildAction method doDrawMemoryMapUsageGraph.
public void doDrawMemoryMapUsageGraph(StaplerRequest req, StaplerResponse rsp) throws IOException {
DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel> dataSet = new DataSetBuilder<>();
String members = req.getParameter("categories");
String graphTitle = req.getParameter("title");
String uniqueDataSet = req.getParameter("dataset");
int w = Integer.parseInt(req.getParameter("width"));
int h = Integer.parseInt(req.getParameter("height"));
List<String> memberList = Arrays.asList(members.split(","));
HashMap<String, ValueMarker> markers = new HashMap<>();
String scale = getRecorder().getScale();
double max = buildDataSet(memberList, uniqueDataSet, dataSet, markers);
filterMarkers(markers);
String s = "";
if (scale.equalsIgnoreCase("kilo")) {
s = "k";
} else if (scale.equalsIgnoreCase("mega")) {
s = "M";
} else if (scale.equalsIgnoreCase("giga")) {
s = "G";
}
String byteLegend = s + "Bytes";
String wordLegend = s + "Words";
String legend = getRecorder().getShowBytesOnGraph() ? byteLegend : wordLegend;
JFreeChart chart = createPairedBarCharts(graphTitle, legend, max * 1.1d, 0d, dataSet.build(), markers.values());
chart.setBackgroundPaint(Color.WHITE);
chart.getLegend().setPosition(RectangleEdge.BOTTOM);
ChartUtil.generateGraph(req, rsp, chart, w, h);
}
use of org.jfree.chart.plot.ValueMarker in project neo4j by neo4j.
the class CoverageChartWriter method createBarChart.
private JFreeChart createBarChart(Map<String, Integer> data) {
if (cached != null) {
return cached;
}
JFreeChart chart = ChartFactory.createBarChart("Spec suite tag distribution", "Tags", "Occurrences in queries", createCategoryDataset(data));
// styling
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setDomainGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.white);
plot.addRangeMarker(new ValueMarker(HORIZONTAL_LINE_VALUE, Color.BLACK, new BasicStroke(2)));
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setSeriesPaint(0, ChartColor.DARK_RED);
renderer.setBarPainter(new StandardBarPainter());
CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
cached = chart;
return chart;
}
use of org.jfree.chart.plot.ValueMarker in project hmftools by hartwigmedical.
the class GradientBarCustomizer method addValueMarker.
private static void addValueMarker(@NotNull final CategoryPlot categoryPlot, final int position, @NotNull final String text) {
final Marker marker = new ValueMarker(position);
final float[] dash = { 3 };
marker.setStroke(new BasicStroke(1.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10, dash, 0));
marker.setPaint(new Color(49, 49, 49));
marker.setLabel(text);
marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
marker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
categoryPlot.addRangeMarker(marker);
}
use of org.jfree.chart.plot.ValueMarker in project Course_Generator by patrovite.
the class JPanelProfil method RefreshProfilChart.
/**
* Update the profil chart
*/
public void RefreshProfilChart() {
if (track == null)
return;
if (track.data.isEmpty())
return;
// -- Clear all series
if (datasetProfil.getSeriesCount() > 0)
datasetProfil.removeAllSeries();
XYPlot plot = chartProfil.getXYPlot();
plot.clearDomainMarkers();
// -- Populate the serie
XYSeries serie1 = new XYSeries("Elevation/Distance");
int cmpt = 1;
for (CgData r : track.data) {
double x = r.getTotal(settings.Unit) / 1000;
double y = r.getElevation(settings.Unit);
serie1.add(x, y);
if (((r.getTag() & CgConst.TAG_MARK) != 0) & showProfilMarker) {
Marker m = new ValueMarker(x);
m.setPaint(Color.GRAY);
m.setLabelFont(new Font("SansSerif", Font.PLAIN, 10));
m.setLabel(String.valueOf(cmpt));
m.setLabelOffset(new RectangleInsets(5, 0, 0, 2));
m.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
m.setLabelTextAnchor(TextAnchor.TOP_LEFT);
plot.addDomainMarker(m);
cmpt++;
}
}
datasetProfil.addSeries(serie1);
if (track.getMaxElev(settings.Unit) > track.getMinElev(settings.Unit)) {
// XYPlot plot = chart.getXYPlot();
ValueAxis axisY = plot.getRangeAxis();
axisY.setRange(Math.floor(track.getMinElev(settings.Unit) / 100.0) * 100.0, Math.ceil(track.getMaxElev(settings.Unit) / 100.0) * 100.0);
}
}
Aggregations