demo/ruoyi-ui/output.txt

183 lines
4.4 KiB
Plaintext

To add a new pie chart to the `src/views/index.vue` file that will display student grades, we need to follow these steps:
1. Import the new pie chart component.
2. Add the new pie chart component to the template.
3. Update the script section to include the new pie chart component.
Here are the *SEARCH/REPLACE* blocks to achieve this:
```vue
##File: /Users/dengwendi/Documents/project/template/ruoyi-ui/src/views/index.vue
<<<<<<< SEARCH
import PanelGroup from './dashboard/PanelGroup'
import LineChart from './dashboard/LineChart'
import RaddarChart from './dashboard/RaddarChart'
import PieChart from './dashboard/PieChart'
import BarChart from './dashboard/BarChart'
=======
import PanelGroup from './dashboard/PanelGroup'
import LineChart from './dashboard/LineChart'
import RaddarChart from './dashboard/RaddarChart'
import PieChart from './dashboard/PieChart'
import BarChart from './dashboard/BarChart'
import StudentGradesPieChart from './dashboard/StudentGradesPieChart'
>>>>>>> REPLACE
```
```vue
##File: /Users/dengwendi/Documents/project/template/ruoyi-ui/src/views/index.vue
<<<<<<< SEARCH
<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<raddar-chart />
</div>
</el-col>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<pie-chart />
</div>
</el-col>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<bar-chart />
</div>
</el-col>
</el-row>
=======
<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<raddar-chart />
</div>
</el-col>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<pie-chart />
</div>
</el-col>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<bar-chart />
</div>
</el-col>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<student-grades-pie-chart />
</div>
</el-col>
</el-row>
>>>>>>> REPLACE
```
```vue
##File: /Users/dengwendi/Documents/project/template/ruoyi-ui/src/views/index.vue
<<<<<<< SEARCH
components: {
PanelGroup,
LineChart,
RaddarChart,
PieChart,
BarChart
},
=======
components: {
PanelGroup,
LineChart,
RaddarChart,
PieChart,
BarChart,
StudentGradesPieChart
},
>>>>>>> REPLACE
```
Additionally, we need to create the `StudentGradesPieChart` component in the `src/views/dashboard/` directory. Here is the *SEARCH/REPLACE* block for that:
```vue
##File: /Users/dengwendi/Documents/project/template/ruoyi-ui/src/views/dashboard/StudentGradesPieChart.vue
<<<<<<< SEARCH
=======
<template>
<div :class="className" :style="{height:height,width:width}" />
</template>
<script>
import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '300px'
}
},
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
left: 'center',
bottom: '10',
data: ['A', 'B', 'C', 'D', 'F']
},
series: [
{
name: 'STUDENT GRADES',
type: 'pie',
roseType: 'radius',
radius: [15, 95],
center: ['50%', '38%'],
data: [
{ value: 320, name: 'A' },
{ value: 240, name: 'B' },
{ value: 149, name: 'C' },
{ value: 100, name: 'D' },
{ value: 59, name: 'F' }
],
animationEasing: 'cubicInOut',
animationDuration: 2600
}
]
})
}
}
}
</script>
>>>>>>> REPLACE
```
These changes will add a new pie chart component to the `index.vue` file, displaying student grades.