Class LineChart
Everything about how a line looks belongs to its ChartSeries (width, marker
size, whether it is filled, whether it curves), because a chart normally mixes them: a
filled band for the range and a plain line for the actual. The chart-level setters here
write through to every series, present and future, as a shorthand for "all of them".
Double.NaN breaks the line. A gap is drawn as a gap, and a filled series
fills each run of real values separately rather than bridging the hole with a shape that
asserts data nobody has.
Unlike bars, the value axis does not begin at zero: a line encodes value as
position rather than as length, so it may zoom into the range that matters.
chart.valueAxis().setBeginAtZero(true) restores the zero baseline.
LineChart chart = new LineChart();
chart.setLabels("00", "04", "08", "12", "16", "20");
chart.addSeries(ChartSeries.of("Latency", 24, 21, 38, 42, 31, 26).setFilled(true));
chart.setSmooth(true);
-
Nested Class Summary
Nested classes/interfaces inherited from class limn.components.chart.Chart
Chart.LegendEntry, Chart.LegendPosition, Chart.TooltipMode -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LineChartof(List<String> labels, ChartSeries... series) A line chart overlabels, with the given series.protected voidonSeriesAdded(ChartSeries added) Called with a series that has just joined the chart, before anything is animated.protected voidpaintMarks(Canvas canvas) Paints the marks inside the plot region; grid and axes are already down.protected intpickSeries(int category, float localX, float localY) Which series a pointer insidecategoryis reporting: the mark it is on if any, and otherwise the nearest one, so a click in the whitespace of a column still names a datum.protected ChartPointpointOf(int seriesIndex, int category) The datum for one series at one category, anchored at that series' mark.setArea(boolean value) Fills every series, and every series added later.setLineWidth(float points) Sets the stroke width of every series, and of every series added later.setPointRadius(float points) Sets the marker radius of every series, and of every series added later (0hides).setSmooth(boolean value) Curves every series, and every series added later.setTension(float value) Sets the curve strength of smoothed series, from0(straight segments) to about0.5(a Catmull-Rom spline through the points).floattension()How hard a smoothed line curves.Methods inherited from class limn.components.chart.CartesianChart
animationBaseline, bandCenter, bandSize, bandStart, categoryAt, categoryAxis, isHorizontal, isStacked, paintContent, pickAt, plotHeight, plotWidth, plotX, plotY, scale, setHorizontal, setStacked, stackBase, stackKeys, stackTotal, tooltipRows, valueAxis, valuePositionMethods inherited from class limn.components.chart.Chart
addSeries, animationDuration, background, categoryCount, clearSeries, contentBoxHeight, contentBoxWidth, contentLeft, contentTop, dataGeneration, drawnValue, elementProgress, ellipsize, hoveredPoint, isLegendInteractive, isTooltipEnabled, label, labels, labelSource, legendChanged, legendEntries, legendPosition, measure, onAttached, onHoverChanged, onMeasure, onMouseEvent, onPaint, onPaintOverlay, onPointClick, onPointHover, palette, pointFor, progress, removeSeries, replayAnimation, series, series, seriesAlpha, seriesColor, seriesCount, setAnimationDuration, setAnimationEasing, setBackground, setLabels, setLabels, setLabels, setLegendInteractive, setLegendPosition, setPalette, setPreferredSize, setSeries, setTitle, setTitle, setTooltipEnabled, setTooltipFormat, setTooltipMode, setValueFormat, staggerFraction, stateFadeSeconds, title, titleSource, toggleLegendEntry, tokens, tooltipMode, tooltipRowColor, tooltipRowName, tooltipRowValue, tooltipTitle, updateRegions, valueFormat, withControlSizeMethods inherited from class limn.scene.Widget
acceptsTextInput, add, baselineOffset, baselineOffsetOf, caretRect, children, clipboard, clipsChildren, controlSize, cursor, declaredControlSize, declaredLayoutDirection, declaredLocale, focusArrivedByTraversal, height, hitTest, imageCursor, invalidate, invalidate, isEnabled, isFocusable, isFocused, isShowing, isVisible, layoutBox, layoutDirection, locale, localToSceneX, localToSceneY, markNeedsContainedLayout, markNeedsLayout, measure, moveChild, neutralBase, onCharTyped, onDetached, onFileDrop, onFocusGained, onFocusLost, onKeyEvent, onLayout, onPreedit, overlayPassesPointer, paintChildren, paintOutset, paintWidget, parent, remove, requestFocus, revealInView, scene, sceneToLocalX, sceneToLocalY, setControlSize, setCursor, setEnabled, setFocusable, setImageCursor, setInheritanceHost, setLayoutDirection, setLocale, setTooltip, setTooltip, setVisible, shapeText, textRuler, tooltip, width, x, y
-
Constructor Details
-
LineChart
public LineChart()
-
-
Method Details
-
of
A line chart overlabels, with the given series. -
setSmooth
Curves every series, and every series added later. SeeChartSeries.setSmooth(boolean). -
setArea
Fills every series, and every series added later. SeeChartSeries.setFilled(boolean). -
setLineWidth
Sets the stroke width of every series, and of every series added later. -
setPointRadius
Sets the marker radius of every series, and of every series added later (0hides). -
tension
public float tension()How hard a smoothed line curves. -
setTension
Sets the curve strength of smoothed series, from0(straight segments) to about0.5(a Catmull-Rom spline through the points). Default0.4. Higher values overshoot past the data. -
onSeriesAdded
Description copied from class:ChartCalled with a series that has just joined the chart, before anything is animated. Charts with per-series defaults of their own apply them here, so a series added after the default was set is styled like the ones that were already there.- Overrides:
onSeriesAddedin classChart
-
paintMarks
Description copied from class:CartesianChartPaints the marks inside the plot region; grid and axes are already down.- Specified by:
paintMarksin classCartesianChart
-
pickSeries
protected int pickSeries(int category, float localX, float localY) Description copied from class:CartesianChartWhich series a pointer insidecategoryis reporting: the mark it is on if any, and otherwise the nearest one, so a click in the whitespace of a column still names a datum.-1when the category has nothing visible in it.- Specified by:
pickSeriesin classCartesianChart
-
pointOf
Description copied from class:CartesianChartThe datum for one series at one category, anchored at that series' mark.- Specified by:
pointOfin classCartesianChart
-