zoukankan      html  css  js  c++  java
  • 创建图表

    Dim myRange As Range

    Dim myChart As ChartObject

    If ActiveSheet.ChartObjects.count > 0 Then

      Sheet1.ChartObjects.Delete

    End if

    Set ab = Range("A1:O10")

    Set myRange = ActiveSheet.ChartObjects.Add(ab.Left, ab.Top, ab.Width, ab.Height)

    Dim rngS1 As Range

    Dim rngS2 As Range

    Set rngS1 = Range("D" & 18 & ":O" & 18)

    Set rngS2 = Range("D" & 19 & ":O" & 19)

    With myChart.Chart

      .ChartType = xlLineMarkers

      .HasTitle = True

      .ChartTitle.Text = "Chart Example"

      With .ChartTitle.Font

        .Size = 10

        .Name = "songti"

      End With

    End With

      myChart.Select

      ActiveChart.SetSourceData Source:=Range("Sheet1!$D$12:$O$14")

      ActiveChart.SeriesCollection(1).Name = "=""xiaban"""

      ActiveChart.SeriesCollection(2).Name = "=""shangban"""

      ActiveChart.SeriesCollection.NewSeries

    ActiveChart.SeriesCollection(3).Name = "=""guige1"""

    ActiveChart.SeriesCollection(3).Values = rngS1

    ActiveChart.SeriesCollection.NewSeries

    ActiveChart.SeriesCollection(4).Name = "=""xiaban"""

    ActiveChart.SeriesCollection(4).Values= rngS2

      ActiveChart.ChartArea.Select

      ActiveChart.PlotArea.Select

    ActiveChart.SeriesCollection(3).Select

      With Selection.Format.Line

        .Visible = msoTrue

        .ForeColor.RGB = RGB(255, 0, 0)

        .DashStyle = msoLineLongDashDot

      End With

      Select.MarkerStyle = -4142

      ActiveChart.SeriesCollection(4).Select

      With Selection.Format.Line

        .Visible = msoTrue

        .ForeColor.RGB = RGB(255,0,0)

        .DashStyle = msoLineDashDot

      End With

      Selection.MarkerStyle = -4142

      'xianshi zai  shang mian

      'ActiveChart.ChartArea.Select

      'ActiveChart.Legend.Select

      'Selection.Position = xlTop

      

      Set myRange = Nothing

      Set myChart = Nothing

      Set rngS1 = Nothing

      Set rngS2 = Nothing

      Range("P1").Select

    End Sub

  • 相关阅读:
    【Xamarin挖墙脚系列:IOS-关于手机支持的屏幕方向】
    【Xamarin挖墙脚系列:Xamarin 上台讲述PPT呵呵呵】
    Java文件下载
    javaWeb学习总结(2)- http协议
    javaWeb学习总结(1)- JavaWeb开发入门
    java中几种获取项目路径方式
    XSS研究1-来自外部的XSS攻击
    Session Cookie的HttpOnly和secure属性
    关于Cookie安全性设置的那些事
    Hibernate 所有缓存机制详解
  • 原文地址:https://www.cnblogs.com/sylar-liang/p/5567835.html
Copyright © 2011-2022 走看看