google / charts

Home Page:https://pub.dev/packages/charts_flutter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Showing legends and values on particular point - Stacked area chart

elmar001 opened this issue · comments

How to show legends of stacked area chart? Is it possible? And also is there a way to show values when user clicks on specific part of stacked area chart.

Ok, I found the way for legends:
behaviors: [
new charts.SeriesLegend(
// Positions for "start" and "end" will be left and right respectively
// for widgets with a build context that has directionality ltr.
// For rtl, "start" and "end" will be right and left respectively.
// Since this example has directionality of ltr, the legend is
// positioned on the right side of the chart.
position: charts.BehaviorPosition.end,
// For a legend that is positioned on the left or right of the chart,
// setting the justification for [endDrawArea] is aligned to the
// bottom of the chart draw area.
outsideJustification: charts.OutsideJustification.endDrawArea,
// By default, if the position of the chart is on the left or right of
// the chart, [horizontalFirst] is set to false. This means that the
// legend entries will grow as new rows first instead of a new column.
horizontalFirst: false,
// By setting this value to 2, the legend entries will grow up to two
// rows before adding a new column.
desiredMaxRows: 2,
// This defines the padding around each legend entry.
cellPadding: new EdgeInsets.only(right: 4.0, bottom: 4.0),
// Render the legend entry text with custom styles.
entryTextStyle: charts.TextStyleSpec(
color: charts.Color(r: 127, g: 63, b: 191),
fontFamily: 'Georgia',
fontSize: 11),
)
],