简体   繁体   English

填充颜​​色的mapael min / max值

[英]mapael min/max values for fill color

I have an example using mapael where I set the fill color based on values from a table of state data. 我有一个使用mapael的例子,我根据状态数据表中的值设置填充颜色。 when the min/max are between 6 and 8 it works and when the values are between 400 and 500 it works but when they are between 5000 and 6000 all states are filled in black although The data does include values between those ranges. 当最小值/最大值介于6和8之间时,它可以工作,当值介于400和500之间时,它可以工作,但当它们介于5000和6000之间时,所有状态都填充为黑色,尽管数据确实包含这些范围之间的值。

    $(".mapcontainer").mapael({
        map: {
            name: "usa_states",
            defaultArea: {
                attrs: {
                    stroke: "#fff",
                    "stroke-width": 1
                }
            }
        },
        legend: {
            area: {
                title: "Frequency by state",
                slices: [
                    {
                        max: valA,
                        attrs: {
                            fill: "#97e766"
                        },
                        label: "LTE " + valA
                    },
                    {
                        min: valA,
                        max: valB,
                        attrs: {
                            fill: "#008080"
                        },
                        label: "Between " + valA + " and " + valB
                    },
                    {
                        min: valB,
                        attrs: {
                            fill: "#DC143C"
                        },
                        label: "GTE " + valB
                    }
                ]
            }
        },
        areas: data
    });

I can't figure out why the color doesn't change with the larger values. 我无法弄清楚为什么颜色不会随着更大的值而改变。 The label for the legend does show the correct value when hovering over the state. 悬停在状态上时,图例的标签确实显示正确的值。

I asked this question and I now see that I did not give enough info to answer it. 我问了这个问题,我现在看到我没有提供足够的信息来回答它。 It turns out that the data values over 999 contained a comma preventing the comparison to the min/max values to fail. 事实证明,超过999的数据值包含一个逗号,阻止与最小/最大值的比较失败。 After cleaning up the numbers it works fine. 清理完数字后,它可以正常工作。 My apologies to those who spent time on this. 我向那些花时间在这上面的人道歉。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM