Package qupath.lib.gui.charts
Class ChartTools
java.lang.Object
qupath.lib.gui.charts.ChartTools
Collection of static methods to help when working with JavaFX charts, 
 and adapting these for QuPath's purposes.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidaddChartExportMenu(XYChart<Number, Number> chart, ContextMenu menu) Add a menu item to a context menu for displaying a chart for export.static voidexpandChartClip(Chart chart, double pad) Expand the clip region for a chart.static StringgetChartDataAsString(XYChart<Number, Number> chart) Get a string representation of chart data, in such a way that it could be pasted into a spreadsheet.static voidmakeChartInteractive(Chart chart, NumberAxis xAxis, NumberAxis yAxis) Make it possible to select chart regions to zoom in, and scroll to navigate around it.static voidsetLineChartLegendLines(Chart chart, double length) Charts tend to show their legends with circular/square markers...static <T> voidsetPieChartData(PieChart chart, Map<T, ? extends Number> counts, Function<T, String> stringFun, Function<T, Color> colorFun, boolean convertToPercentages, boolean includeTooltips) Set pie chart data from a count map.
- 
Constructor Details- 
ChartToolspublic ChartTools()
 
- 
- 
Method Details- 
getChartDataAsStringGet a string representation of chart data, in such a way that it could be pasted into a spreadsheet.- Parameters:
- chart-
- Returns:
 
- 
makeChartInteractiveMake it possible to select chart regions to zoom in, and scroll to navigate around it. Also double-click to stop zooming.- Parameters:
- chart-
- xAxis-
- yAxis-
 
- 
addChartExportMenuAdd a menu item to a context menu for displaying a chart for export.- Parameters:
- chart-
- menu-
 
- 
setLineChartLegendLinesCharts tend to show their legends with circular/square markers... which isn't much use when line strokes distinguish between different Series. This method addresses this by setting the graphics for legend labels to be lines with the appropriate strokes.- Parameters:
- chart-
- length-
 
- 
expandChartClipExpand the clip region for a chart. This helps to avoid clipping off markers at the chart boundaries.- Parameters:
- chart-
- pad- The amount by which to expand the clip rectangle in each direction; if < 0, the clip will be completely removed
 
- 
setPieChartDatapublic static <T> void setPieChartData(PieChart chart, Map<T, ? extends Number> counts, Function<T, String> stringFun, Function<T, Color> colorFun, boolean convertToPercentages, boolean includeTooltips) Set pie chart data from a count map.- Type Parameters:
- T- the type of the data being counted
- Parameters:
- chart- the pie chart to update
- counts- mapping between items and their counts
- stringFun- function to extract a string from each item (may be null to use default- toString()method)
- colorFun- function to extract a color from each item (may be null to use default colors)
- convertToPercentages- if true, convert counts to percentages; if false, use original values
- includeTooltips- if true, install tooltips for each 'slice' to display the numeric information
 
 
-