首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >日期范围滑块未在react-google-charts中呈现

日期范围滑块未在react-google-charts中呈现
EN

Stack Overflow用户
提问于 2018-11-06 03:22:47
回答 1查看 612关注 0票数 0

显示渲染图形的屏幕截图:

代码语言:javascript
运行
复制
    <Chart
            width={'100%'}
            height={'600px'}
            chartType="LineChart"
            loader={<div>Loading Chart</div>}
            data={[
                ['Date', 'Value'],
                [new Date(1996, 1, 1), 2000 * Math.random()],
                [new Date(1997, 1, 1), 2000 * Math.random()],
                [new Date(1998, 1, 1), 2000 * Math.random()],
                [new Date(1999, 1, 1), 2000 * Math.random()],
                [new Date(2000, 1, 1), 2000 * Math.random()],
                [new Date(2001, 1, 1), 2000 * Math.random()],
                [new Date(2002, 1, 1), 2000 * Math.random()],
                [new Date(2003, 1, 1), 2000 * Math.random()],
                [new Date(2004, 1, 1), 2000 * Math.random()],
                [new Date(2005, 1, 1), 2000 * Math.random()],
                [new Date(2006, 1, 1), 2000 * Math.random()],
                [new Date(2007, 1, 1), 2000 * Math.random()],
                [new Date(2008, 1, 1), 2000 * Math.random()],
                [new Date(2009, 1, 1), 2000 * Math.random()],
            ]}
            options={{
                // Use the same chart area width as the control for axis alignment.
                chartArea: { height: '80%', width: '90%' },
                hAxis: { slantedText: false },
                vAxis: { viewWindow: { min: 0, max: 2000 } },
                legend: { position: 'none' },
            }}
            chartPackages={['corechart', 'controls']}
            controls={[
                {
                    controlType: 'ChartRangeFilter',
                    options: {
                        filterColumnIndex: 0,
                        ui: {
                            chartType: 'LineChart',
                            chartOptions: {
                                chartArea: { width: '90%', height: '50%' },
                                hAxis: { baselineColor: 'none' },
                            },
                        },
                    },
                    controlPosition: 'bottom',
                    controlWrapperParams: {
                        state: {
                            range: { start: new Date(1996, 1, 9), end: new Date(2010, 2, 20) },
                        },
                    },
                },
            ]}
        /> 

我可以渲染图形,但看不到日期范围滑块来控制日期范围,有人可以帮助解决这个问题吗?我尝试在x轴上显示时间范围,在y轴上显示一些数字数据。我只是从react-google-charts中复制了代码,并没有做太多修改,我还需要在代码中包含什么吗?

EN

回答 1

Stack Overflow用户

发布于 2018-11-13 23:05:42

我试图重现这个问题,但正如你所看到的here,它工作正常。

您遇到的问题有两种可能的原因:

  1. 您正在使用旧版本的react-google- chart (< 3.0)
  2. 某些页面css正在覆盖图表高度(包含在高度小于图表的div中) ?

希望这能有所帮助,

干杯!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53160843

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档