findDataPoints() 中的 Flex PlotChart 缩放错误

发布于 2024-12-03 11:57:25 字数 999 浏览 1 评论 0原文

我发现了这个很棒的教程,介绍如何通过在折线图中绘制矩形来放大图表来放大图表(http://blog.ninjacaptain.com/2010/03/flex-chart-zoom-window/),但我正在尝试将其应用于相反,我在尝试获取显示以下错误的 DataTips 时遇到问题:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at mx.charts.series::PlotSeries/findDataPoints()[E:\dev\4.5.1\frameworks\projects\charts\src\mx\charts\series\PlotSeries.as:961]
    at mx.charts.chartClasses::ChartBase/findDataPoints()[E:\dev\4.5.1\frameworks\projects\charts\src\mx\charts\chartClasses\ChartBase.as:2069]
    at mx.charts.chartClasses::ChartBase/mouseClickHandler()[E:\dev\4.5.1\frameworks\projects\charts\src\mx\charts\chartClasses\ChartBase.as:4823]

链接提到了有关扩展 LineChartSeries 并覆盖 findDataPoints() 函数,但在尝试对扩展 PlotSeries.as 执行相同操作后,sortOnXField 似乎未定义,我无权访问 PlotSeries.as,因为它位于 swc 中。

有没有人尝试将以下内容应用于 PlotChart 并显示数据提示? findDataPoints() 中的覆盖函数是什么?

谢谢

I came across this great tutorial on how to zoom into a chart by drawing a rectangle in a LineChart to zoom into it (http://blog.ninjacaptain.com/2010/03/flex-chart-zoom-window/) but i'm trying to apply it to a PlotChart instead and i'm having issues trying to get the DataTips showing with the following error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at mx.charts.series::PlotSeries/findDataPoints()[E:\dev\4.5.1\frameworks\projects\charts\src\mx\charts\series\PlotSeries.as:961]
    at mx.charts.chartClasses::ChartBase/findDataPoints()[E:\dev\4.5.1\frameworks\projects\charts\src\mx\charts\chartClasses\ChartBase.as:2069]
    at mx.charts.chartClasses::ChartBase/mouseClickHandler()[E:\dev\4.5.1\frameworks\projects\charts\src\mx\charts\chartClasses\ChartBase.as:4823]

The link mentioned about extending the LineChartSeries and override the findDataPoints() function, but after trying to doing the same for extending PlotSeries.as, sortOnXField seems to be undefined and I don't have access to the PlotSeries.as since it is in a swc.

Has anyone tried applying the following to a PlotChart instead and got the DataTips to show? What was the override function in the findDataPoints()?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

三人与歌 2024-12-10 11:57:25

几天前我在 PieSeries 上遇到了同样的问题。

我还没有找到为什么“filterDataPoints”函数中“_renderData.filteredCache”为空,但同时我已经解决了以这种方式扩展 PieSeries 类的问题:

package com.eque.report.model {

import mx.charts.series.PieSeries;

public class MyPieSeries extends PieSeries {

    public function MyPieSeries () {
        super();
    }

    /**
     * 'findDataPoints' function has been overriden in order to prevent
     * '_renderData.filteredCache' is null.
     */
    override public function findDataPoints(x:Number, y:Number, sensitivity:Number):Array {
        if (renderData.filteredCache == null) {
            renderData.filteredCache = [];
        }
        return super.findDataPoints(x, y, sensitivity);
    }

}
}

我希望它可以帮助您

Some days ago I had the same problem with PieSeries.

I have not found yet why '_renderData.filteredCache' is null in 'filterDataPoints' function, but meanwhile I have resolved the problem extending PieSeries Class this way:

package com.eque.report.model {

import mx.charts.series.PieSeries;

public class MyPieSeries extends PieSeries {

    public function MyPieSeries () {
        super();
    }

    /**
     * 'findDataPoints' function has been overriden in order to prevent
     * '_renderData.filteredCache' is null.
     */
    override public function findDataPoints(x:Number, y:Number, sensitivity:Number):Array {
        if (renderData.filteredCache == null) {
            renderData.filteredCache = [];
        }
        return super.findDataPoints(x, y, sensitivity);
    }

}
}

I hope it could help you

遗心遗梦遗幸福 2024-12-10 11:57:25

如果您询问如何解决访问图表点时的“filterDataPoints”问题,您只需创建自己的 Series 类,将 PlotSeries 中的代码复制粘贴到其中,并更改运行时失败的任何内容。你会得到什么样的错误?

If you're asking about how to solve the "filterDataPoints" issue in accessing chart points, you just have to create you own Series class, copy-paste the code from PlotSeries in it and change whatever fails on runtime. What kind of error do you get ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文