若依大数据首页统计

<template>
  <div class="dashboard-editor-container">

    <panel-group @handleSetLineChartData="handleSetLineChartData" />

    <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
      <line-chart :chart-data="lineChartData" />
    </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-row>

    
  </div>
</template>

<script>
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'

const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145]
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130]
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130]
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130]
  }
}

export default {
  name: 'Index',
  components: {
    PanelGroup,
    LineChart,
    RaddarChart,
    PieChart,
    BarChart
  },
  data() {
    return {
      lineChartData: lineChartData.newVisitis
    }
  },
  methods: {
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type]
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
大数据词频统计是指对大量文本进行分析,统计其中每个词出现的频率。下面是一个详细的步骤和代码示例: 1. 数据准备 首先需要准备一份包含大量文本的数据集,可以是一个或多个文件。例如,我们可以使用以下的文本数据: ``` The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog again. The lazy dog is too tired to move. ``` 2. 数据清洗 将文本数据进行清洗,去除标点符号、空格、换行符等无关信息,只保留单词。可以使用正则表达式来实现。 ``` import re def clean_text(text): # 去除标点符号 text = re.sub(r'[^\w\s]', '', text) # 转换为小写 text = text.lower() # 去除空格和换行符 text = re.sub(r'\s+', ' ', text) # 返回单词列表 return text.strip().split() # 读取文本数据 with open('data.txt', 'r') as f: data = f.read() # 清洗文本数据 words = clean_text(data) ``` 3. 统计词频 使用字典来记录每个单词出现的次数,遍历单词列表,对于每个单词,如果在字典中已存在,则将计数器加1,否则将其添加到字典中。 ``` # 统计词频 word_freq = {} for word in words: if word in word_freq: word_freq[word] += 1 else: word_freq[word] = 1 # 输出前10个出现频率最高的单词 for word, freq in sorted(word_freq.items(), key=lambda x: x[1], reverse=True)[:10]: print(word, freq) ``` 输出结果如下: ``` the 4 lazy 2 dog 2 quick 2 brown 2 fox 2 jumps 2 over 2 again 1 is 1 ``` 这些单词的出现频率是按照从高到低的顺序排列的。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

飞飞翼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值