标题:有偿制作,vb6里面能根据数据中的4个项目做“管制图”吗?
只看楼主
kings12333
Rank: 2
等 级:论坛游民
帖 子:112
专家分:59
注 册:2012-11-29
得分:0 
回复 20楼 yuma
应该比较麻烦
2023-02-13 21:05
mrexcel
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:22
帖 子:125
专家分:480
注 册:2022-11-3
得分:4 
以下是引用kings12333在2023-2-13 18:54:27的发言:

如果左,右两边的刻度不一样,该如何绘制两组数据(即一组数据参考左边的刻度,一组参考右边的刻度)

双轴双柱图,EXCEL和PowerPoint的图表是支持的
2023-02-14 16:41
cwa9958
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:67
帖 子:247
专家分:1228
注 册:2006-6-25
得分:0 
回复 19楼 kings12333
排列图?
2023-02-15 08:23
freeshierly
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2021-6-18
得分:0 
这是管理图。很简单的折线图。用不着vb,用EXCEL 就完成了。
2023-02-15 08:30
William1949
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:109
专家分:0
注 册:2009-3-17
得分:0 
回复 11楼 cuituo
vb 竖排文字 可以使用 CreateFont api 来实现,把其中一个参数设为90度,就能达到竖排的效果,不过这样做出来,每个字符都是斜的(一楼图)。

还有一种方法:使用 PolyTextOut  来实现 ,设置每个字符的 X、Y 坐标 达到竖排的效果,

示例:

程序代码:
Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function SetTextAlign Lib "gdi32" (ByVal hDc As Long, ByVal wFlags As Long) As Long
Private Declare Function GetTextMetricsA Lib "gdi32" (ByVal hDc As Long, lpMetrics As Any) As Long

Private Type POLYTEXT
    X       As Long
    Y       As Long
    cCh     As Long
    lpStr   As Long
    uiFlags As Long
    Rcl(3)  As Long
    pDx     As Long
End Type
Private Declare Function PolyTextOutW Lib "gdi32" (ByVal hDc As Long, pPTxt As POLYTEXT, ByVal cStrings As Long) As Long

Private Sub Command1_Click()
    Call strVertical(10, 0, Me.hDc, "VB竖排文字")
End Sub

Private Sub strVertical(ByVal X As Long, ByVal Y As Long, ByVal hDc As Long, ByVal Text As String)
    Dim sLen        As Long, P As Long, teY As Long, oldAlign As Long, tmHeight As Long, tmExternalLeading As Long
    Dim iPT()       As POLYTEXT
    Dim iStr()      As String
    Dim lpMetrics() As Byte

    oldAlign = SetTextAlign(hDc, 6)

    ReDim lpMetrics(52) As Byte
    Call GetTextMetricsA(hDc, lpMetrics(0))
    Call CopyMemory(tmHeight, lpMetrics(0), 4)
    Call CopyMemory(tmExternalLeading, lpMetrics(16), 4)

    sLen = Len(Text) - 1
    ReDim iPT(sLen) As POLYTEXT
    ReDim iStr(sLen) As String
    For P = 0 To sLen
        iStr(P) = Mid$(Text, P + 1, 1)
        With iPT(P)
            .X = X
            .Y = Y + teY
            .cCh = 1
            .lpStr = StrPtr(iStr(P))
        End With
        teY = teY + tmHeight + tmExternalLeading
    Next
    Call PolyTextOutW(hDc, iPT(0), sLen + 1)
    Call SetTextAlign(hDc, oldAlign)
    Erase lpMetrics(), iPT(), iStr()
End Sub
收到的鲜花
  • 风吹过b2023-02-15 17:33 送鲜花  5朵   附言:这个方法可以
2023-02-15 10:42
牛掰
Rank: 2
等 级:论坛游民
帖 子:28
专家分:87
注 册:2020-4-17
得分:0 
回复 25楼 William1949
请问老师有附件吗?
2023-02-15 12:22
kings12333
Rank: 2
等 级:论坛游民
帖 子:112
专家分:59
注 册:2012-11-29
得分:0 
回复 23楼 cwa9958
对,就这个意思,用VB MSChart控件能写吗?
2023-02-15 14:52
yuma
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:银河系
等 级:贵宾
威 望:33
帖 子:1883
专家分:2904
注 册:2009-12-22
得分:0 
有人来点赞吗,不用API文字也可以竖排。

Private Function Vertical_Horizontal(ByVal nStr As String) As String
    Dim MyStr As String, i As Integer
    Static Vert As Boolean
    For i = 1 To Len(nStr)
        If i < Len(nStr) Then
            MyStr = MyStr + Mid$(nStr, i, 1) & vbCrLf
        Else
            MyStr = MyStr + Mid$(nStr, i, 1)
        End If
    Next
    Vertical_Horizontal = MyStr
    Vert = True
End Function
Private Sub Form_Load()
    Label1.AutoSize = True
    Label1.Caption = "VB让Label标签里的文字竖排"
    Label1.Caption = Vertical_Horizontal(Label1.Caption)
End Sub

心生万象,万象皆程序!
本人计算机知识网:http://bbs.为防伸手党,本站已停止会员注册。
2023-02-16 19:17
kings12333
Rank: 2
等 级:论坛游民
帖 子:112
专家分:59
注 册:2012-11-29
得分:0 
回复 28楼 yuma
大佬,你给的代码图表需要对其中一个柱子的改颜色改如何写啊.
程序代码:
Private Sub Form_Load()
    Randomize Timer
    Dim i As Integer, jls As Integer
    Dim Values(1 To 15, 1 To 3)
    For i = 1 To 15
        Values(i, 1) = "T" & Format(i, "00")
    Next i
   
    For i = 1 To 15

        Values(i, 3) = Rnd * 100
    Next i
    MSChart1.chartType = VtChChartType2dCombination
    MSChart1.Plot.SeriesCollection.Item(1).SeriesType = VtChSeriesType2dLine
    MSChart1.Plot.SeriesCollection.Item(2).SeriesType = VtChSeriesType2dBar
    MSChart1.ChartData = Values
End Sub


2023-02-16 19:27
yuma
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:银河系
等 级:贵宾
威 望:33
帖 子:1883
专家分:2904
注 册:2009-12-22
得分:0 
不知道、只能统一为一种颜色好像。如红色、绿色、蓝色。

心生万象,万象皆程序!
本人计算机知识网:http://bbs.为防伸手党,本站已停止会员注册。
2023-02-16 19:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-511228-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.070276 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved