Giter Club home page Giter Club logo

Comments (4)

echarts-bot avatar echarts-bot commented on May 22, 2024

@guoliuqing123 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗

TRANSLATED

TITLE

[Bug] Add title display to each radar chart

BODY

Version

none

Link to Minimal Reproduction

none

Steps to Reproduce

let data = [
[
[ "Technology\nGuarantee\nCentral\nHeart\n", "#255359",4.94,5, 5.01,4.98,4.96,4.93,4.94],
["Network\nCenter\nHeart\n","#336774", 4.96,5.02, 5.01, 5,4.99,4.98,4.97]
],
]

  let arr1 = []
  let arr2 = []
  if (data && data.length > 0) {
    data.forEach((items,index) => {
      let y = data.length === 1 ? '50%' : '';
      let radius = '35%';

      if(items[0]) {
        let obj1 ={
          center: data.length === 1 ? ['28%', y] : ['28%', y], //Radar chart position
          radius: radius, //Radar chart diameter
          indicator: [
            {name: 'W1', max: 10},
            {name: 'W7', max: 10, axisLabel: {show: false}},
            {name: items[0][0]+' '+' W6', max: 10, axisLabel: {show: false}},
            // {name: 'W6', max: 10, axisLabel: {show: false}},
            {name: 'W5', max: 10, axisLabel: {show: false}},
            {name: 'W4', max: 10, axisLabel: {show: false}},
            {name: 'W3', max: 10, axisLabel: {show: false}},
            {name: 'W2', max: 10, axisLabel: {show: false}}
          ],
          nameGap:5, //The distance between the indicator name and the indicator axis.
          splitNumber: 5, // Radar chart circle setting
          axisLine: { //Set the color of the middle ray of the radar chart
            lineStyle: {
              color: '#fff',
            },
          },
          axisLabel: {
            show: false,
            textStyle: {
              fontSize: 8,
              color: '#333',
            }
          }, //axis text label
          splitArea: { //Set the chart color, the value of show is true
            show: false,
            areaStyle: {
              color: "#fff", //General setting method
            },
          },
          name: { //Modify the color of indicator text
            textStyle: {
              color: "#4f4f4f",
              fontSize:7,
            }
          },
        };
        arr1.push(obj1)
        let obj3 ={
          type: 'radar',
          radarIndex: arr1 && arr1.length ? arr1.length-1 :'',
          symbolSize:4,
          data: [{
            name:items[0][0],
            value: items[0].slice(2),
            itemStyle: { //Style settings for this numerical area
              normal: {
                color: items[0][1], //Background color, areaStyle also needs to be set
              },
            },
          },]
        };
        arr2.push(obj3)
      }
      if(items[1]){
        let obj2 ={
          center: data.length === 1 ? ['73%', y] : ['73%', y], //Radar chart position
          radius: radius, //Radar chart diameter
          indicator: [
            {name: 'W1', max: 10},
            {name: 'W7', max: 10, axisLabel: {show: false}},
            {name: items[1][0]+' '+' W6', max: 10, axisLabel: {show: false}},
            // {name: 'W6', max: 10, axisLabel: {show: false}},
            {name: 'W5', max: 10, axisLabel: {show: false}},
            {name: 'W4', max: 10, axisLabel: {show: false}},
            {name: 'W3', max: 10, axisLabel: {show: false}},
            {name: 'W2', max: 10, axisLabel: {show: false}}
          ],
          nameGap:5, //The distance between the indicator name and the indicator axis.
          splitNumber: 5, // Radar chart circle setting
          axisLine: { //Set the color of the middle ray of the radar chart
            lineStyle: {
              color: '#fff',
            },
          },
          axisLabel: {
            show: false,
            textStyle: {
              fontSize: 8,
              color: '#333',
            }
          }, //axis text label
          splitArea: { //Set the chart color, the value of show is true
            show: false,
            areaStyle: {
              color: "#fff", //General setting method
            },
          },
          name: { //Modify the color of indicator text
            textStyle: {
              color: "#4f4f4f",
              fontSize:7,
            }
          },
        };
        arr1.push(obj2)
        let obj4 ={
          type: 'radar',
          radarIndex: arr1 && arr1.length ? arr1.length-1 :'',
          symbolSize:4,
          data: [
            {
              name:items[1][0],
              value: items[1].slice(2),
              itemStyle: { //Style settings for this numerical area
                normal: {
                  color: items[1][1], //Background color, areaStyle also needs to be set
                },
              },
            },
          ]
        };
        arr2.push(obj4)
      }
    });
  }

  option ={
    radar:arr1,
    series:arr2,
    tooltip: {
      formatter(params){
        return (params.name + '<br/>'+
          'W1: '+params.value[0]+ '<br/>'+
          'W2: '+params.value[1]+ '<br/>'+
          'W3: '+params.value[2]+ '<br/>'+
          'W4: '+params.value[3]+ '<br/>'+
          'W5: '+params.value[4]+ '<br/>'+
          'W6: '+params.value[5]+ '<br/>'+
          'W7: '+params.value[6]
        )
      },
    },
  }

Current Behavior

QQ1
The current style is implemented in the name of the indicator. If the fontweight is modified in this way, other text will also be affected. If you want to achieve a picture that behaves as expected, when you modify the fontweight, other text will not be affected.

Expected Behavior

QQ3
If you want to achieve the image that behaves as expected, when you modify the fontweight, other text will not be affected.

Environment

-OS:
-Browser:
- Framework:

Any additional comments?

No response

from echarts.

plainheart avatar plainheart commented on May 22, 2024

不能直接用 title 组件设置吗?

from echarts.

guoliuqing123 avatar guoliuqing123 commented on May 22, 2024

只能设置一个title 现在想要实现为每一个雷达图旁边都设置一个title

from echarts.

plainheart avatar plainheart commented on May 22, 2024

title 也可以是一个数组,并不是只支持一个,大多数 component 都是默认支持多个的。参见这个例子

from echarts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.