Hi,

1. For callback function.

itemStyle: {
            color: function (params) {
                return params.value[1] > 80 ? 'red' : 'green';
            }
        }

2. For visualMap component

    visualMap: {
        type: 'piecewise',
        pieces: [{
            lt: 80,
            color: 'green'
        }, {
            gt: 80,
            color: 'red'
        }]
    }


Regards.

On Tue, Nov 5, 2019 at 2:59 PM Ayaskant Swain <ayaskant.sw...@gmail.com>
wrote:

> Hi,
>
> Can you please provide me a sample code snippet for the above reqs? The
> documents sent by Wenil has lots of data :-) .
>
> Thanks
> Ayaskant
>
> On Tue, Nov 5, 2019 at 12:09 PM Ayaskant Swain <ayaskant.sw...@gmail.com>
> wrote:
>
>> Hi Wenli & Shen,
>>
>> Many thanks for your quick reply. I will try your suggestions.
>>
>> Just to re-iterate our chart will be a mix of 2 colors (green and red)
>> where the red bars will be very less in numbers. Example if there are 100
>> data points coming in from a stream 2 or 3 will be in red as they will
>> exceed a threshold value on Y-Axis (lest say 90%). Hope that makes my query
>> clearer.
>>
>> Thanks
>> Ayas
>>
>> On Tue, Nov 5, 2019 at 12:00 PM Yi Shen <shenyi....@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Besides using visualMap component mentioned in Wenli's reply.
>>>
>>> There are two other ways to set different colors on specific data points.
>>>
>>> 1. Use callback function for series.itemStyle.color[1]
>>> 2. Set itemStyle.color in the specific data item[1]
>>>
>>> In your case, I think using callback function or visualMap-piecewise
>>> <https://echarts.apache.org/en/option.html#visualMap-piecewise> component 
>>> Wenli mentioned are
>>> both OK.
>>>
>>> [1].
>>> https://echarts.apache.org/en/option.html#series-bar.itemStyle.color
>>> [2].
>>> https://echarts.apache.org/en/option.html#series-bar.data.itemStyle.color
>>>
>>>
>>> Regards.
>>>
>>>
>>> On Tue, Nov 5, 2019 at 2:20 PM Ayaskant Swain <ayaskant.sw...@gmail.com>
>>> wrote:
>>>
>>>> Hi Team,
>>>>
>>>> I have query regarding the Bar charts supported by e-charts. Our
>>>> requirement is to plot an incoming data points against time.
>>>>
>>>> Time will be on X-axis & Data Value will be on Y-Axis. Our requirement
>>>> is
>>>> to show red color only in specific data points. That is if the data
>>>> value
>>>> exceeds a particular value (example 80) show it as red bar while rest of
>>>> the bars will be shown as green.
>>>>
>>>> I saw the below 2 charts on your website. But here the colors for any
>>>> specific category is homogeneous. We need a mix of 2 colors:
>>>>
>>>> https://echarts.apache.org/examples/en/editor.html?c=bar-gradient
>>>> https://echarts.apache.org/examples/en/editor.html?c=bar1
>>>>
>>>> Is it possible to achieve that in e-charts?
>>>>
>>>> Thanks
>>>> Ayaskant
>>>>
>>>
>>>
>>> --
>>> Yi Shen
>>> Apache ECharts(incubating) PPMC
>>>
>>

-- 
Yi Shen
Apache ECharts(incubating) PPMC

Reply via email to