简体   繁体   English

剑道Angular 2图表

[英]Kendo Angular 2 Chart

The existing chart code is like as follows : 现有的图表代码如下:

jQuery("#staarAllSubjectGrades").kendoChart({
    legend: {
        visible: true,
        position: 'bottom'
    },
    seriesDefaults: {
        type: "column",
        labels: {
            visible: true,
            template: "#= (!value || value < 0) ? 'N/A' : (value).toFixed(0) + '%' #",
        }
    },
    tooltip: {
        visible: true,
        template: "#= series.name #: #= (!value || value < 0) ? 'N/A' : (value).toFixed(0) + '%' #",
        color: 'white'
    },
    dataSource: {
        data: finalData
    },
    series: series,
    valueAxis: {
        majorGridLines: {
            visible: true
        },
        labels: {
            template: "#= (value).toFixed(0) # %"
        },
        visible: true,
        min: 0
    },
    categoryAxis: {
        field: "DISTNAME",
        labels: { visible: this.stateStaarAllSubjectGrades },
        majorGridLines: {
            visible: false
        },
        line: {
            visible: false
        }
    }
})

and the output chart is like as : 输出图表如下:

Existing-Chart-Output 现有的测试图,输出

When I use the following code of angular 2 kendo charts : 当我使用以下角度2剑道图表的代码时:

<kendo-chart>
    <kendo-chart-category-axis>
        <kendo-chart-category-axis-item [categories]="chartStaarAllSubjectGrades.categories">
            <kendo-chart-category-axis-item-labels [visible]="stateStaarAllSubjectGrades">
            </kendo-chart-category-axis-item-labels>
            <kendo-chart-category-axis-item [majorGridLines]="{ visible: false }" [line]="{ visible: true }">
            </kendo-chart-category-axis-item>
        </kendo-chart-category-axis-item>
    </kendo-chart-category-axis>
    <kendo-chart-series>
        <kendo-chart-series-item [data]="chartStaarAllSubjectGrades.series"> 
        </kendo-chart-series-item>
    </kendo-chart-series>
    <kendo-chart-value-axis>
        <kendo-chart-value-axis-item>
            <kendo-chart-value-axis-item-labels [content]="value + '%'">
            </kendo-chart-value-axis-item-labels>
        </kendo-chart-value-axis-item>
    </kendo-chart-value-axis>
</kendo-chart> 

Then the output is like as : 然后输出就像:

New Output 新输出

Please assist me how can I show '%' in the left hand side of the chart and how can I show the labels similar to the existing output 请协助我如何在图表的左侧显示'%',以及如何显示类似于现有输出的标签

Well I have manage to get around this issue. 好吧,我设法解决这个问题。 Here is the code : 这是代码:

 <kendo-chart>
  <kendo-chart-legend position="bottom"></kendo-chart-legend>
  <kendo-chart-series-defaults type="column">
   <kendo-chart-series-defaults-labels format="p">
   </kendo-chart-series-defaults-labels>
  </kendo-chart-series-defaults>

 <kendo-chart-series> 
  <kendo-chart-series-item  *ngFor="let item of chartStaarAllSubjectGrades.series" [name]="item.category" [data]="[item]">  
  </kendo-chart-series-item>  
 </kendo-chart-series>

  <kendo-chart-value-axis>
   <kendo-chart-value-axis-item>
       <kendo-chart-value-axis-item-labels format="p">
       </kendo-chart-value-axis-item-labels>
   </kendo-chart-value-axis-item>
 </kendo-chart-value-axis>

 </kendo-chart> 

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

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