在波动图中隐藏主轴

时间:2019-08-29 06:28:26

标签: flutter charts

我的主轴定义如下:

primaryMeasureAxis: new charts.NumericAxisSpec(
  tickProviderSpec: new charts.StaticNumericTickProviderSpec(
    <charts.TickSpec<num>>[
      charts.TickSpec<num>(_serverData.minVal),
      charts.TickSpec<num>(_serverData.maxVal),
    ],
  ),
),

如何在保持TickSpec的同时隐藏轴?

此致

2 个答案:

答案 0 :(得分:0)

得到解决方案:

renderSpec: new charts.NoneRenderSpec()

此处是用于隐藏LineChart上的域轴的完整实现

charts.LineChart(chartData,
                defaultRenderer: new charts.LineRendererConfig(
                    includeArea: true, stacked: true),
                animate: false,
              domainAxis: new charts.NumericAxisSpec(
                  showAxisLine: true,
                  renderSpec: new charts.NoneRenderSpec()),),

答案 1 :(得分:0)

对于折线图,这对我有用:

String jsonFile =
        await rootBundle.loadString('data/country_phone_codes.json');
    Iterable jsonCountryList = jsonDecode(jsonFile);
    List<DropdownMenuItem> stringCountries = jsonCountryList
        .map((dyn) => new DropdownMenuItem(
              child: Text('${dyn['flag']}   ${dyn['name']}',
                  style: textStyleForTitleMedium),
              value: dyn,
            ))
        .toList();

更多信息,请访问:https://google.github.io/charts/flutter/example/axes/hidden_ticks_and_labels_axis.html