蛙蛙池塘

没有公主的蛙蛙王子

胡浩ID:onlytiancai
122685次访问,排名673好友1人,关注者1
onlytiancai的文章
原创 93 篇
翻译 0 篇
转载 22 篇
评论 117 篇
蛙蛙王子的公告
残荷听雨,梨花飞雪,落英缤纷时节。晓来谁染枫林醉?点点都是离人泪
活着,就是快乐!自信,就是美丽! 有人爱,就是幸福。

但愿野百合也有春天

最近评论
hdnero:wow power leveling
hdnero:wow power leveling
lindahou:THANK YOU VERY MUCH
mylittledog:如果我要添加http://172.20.50.11呢?
hm8030:问题2:请教:怎样让页面局部无刷新更新数据呀,xmlhttp可以发送recordset吗?

问题是这样的:我的首页上有好几处显示数据的表格,每个表示对应着服务器的一个记录集(recordset),我想让其中几个表格能够每隔30秒种更新一下数据,前提是网页的其它部分,比如说广告,图片等不用更新。
整个页面的无刷新更新和只更新某个字符串我已经做到了,现在我是想让一……
文章分类
收藏
    相册
    友情博客
    Anatoly 姐姐的博客
    Bob Beauchemin姐姐的博客
    chnking姐姐的博客
    cocosoft姐姐的博客
    donet姐姐的博客
    Eric/xin姐姐的博客
    ilqtj姐姐的博客
    JAVA姐姐的博客
    Nathan Dunlap姐姐的博客
    Sinoprise Studios姐姐的博客
    千山一鸟的博客
    土人姐姐的博客
    微软姐姐的博客
    思归姐姐的博客
    木子姐姐的博客
    笨笨姐姐的博客
    阿好姐姐的博客
    飞信美眉 飞信交友
    龙卷风姐姐的博客
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    原创 蛙蛙推荐:在HTML里利用OWC做图表收藏

    新一篇: WawaKM征集4名有兴趣参与开源项目人员 | 旧一篇: 蛙蛙推荐:微软网络讲座系列教程视频下载(2004年1月到2005年4越)

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="蛙蛙王子">
    <META NAME="Keywords" CONTENT="owc,报表,图表">
    <META NAME="Description" CONTENT="呵呵,哥们把vb的一个例子彻底转换成vbs脚本并移植到网页了,就为了做一个既好看性能又好的图表控件,哥们找了N多资料,光看VML就看的眼画了,本来想用VML写一个chart控件的,后来太麻烦了,直接用OWC算了,功能也暴强,OWC不用我介绍了吧,估计就算我费半天劲学好VML,再学好JS的面向对象开发,最后写出一个VMLCHART估计也没这么强大,微软免费提供的东西为什么不利用一下呢,昨天和今天刚看了MS的一个sql reporting serivice的视频教程,那个更NB,有空装一个,什么报表,图表统统搞定,不过什么东西都有缺点,我写的这个例子必须在客户端安装OFFICE才行,或者得单独分发OWC组件才行,我在对象声明的时候没有写DLL的位置,也没有引用网上的CAB包,大家测试的时候装个OFS200就可以了">
    <SCRIPT LANGUAGE="VbScript">
    Private Sub Command1_Click()

        'Create arrays for the x-values and the y-values
     '为X轴数据和Y轴数据定义几个数组
        Dim xValues, yValues1, yValues2
        'xValues = Array("Beverages", "Condiments", "Confections", _
        '               "Dairy Products", "Grains & Cereals", _
        '               "Meat & Poultry", "Produce", "Seafood")
     xValues = Array("饮料", "调味品", "糖果", _
                        "乳制品", "鱼肉", _
                        "家禽肉类", "农作物", "海产食品")
       
     yValues1 = Array(104737, 50952, 78128, 117797, 52902, 80160, 47491, _
                         62435)
        yValues2 = Array(20000, 15000, 36000, 56000, 40000, 18000, 20000, _
                         33000)

        'Create a new chart
     '创建一个新的图表对象
        Dim oChart,chConstants
        ChartSpace1.Clear '清空图表
        ChartSpace1.Refresh '重绘图表
        Set oChart = ChartSpace1.Charts.Add '新建一个空图表
     Set chConstants = ChartSpace1.Constants '在 VBScript 中使用命名常量

        'Add a title to the chart
        oChart.HasTitle = True
        oChart.Title.Caption = "Sales Per Category"

        'Add a series to the chart with the x-values and y-values
        'from the arrays and set the series type to a column chart
        Dim oSeries
        Set oSeries = oChart.SeriesCollection.Add
        With oSeries
            .Caption = "1995"
            .SetData chConstants.chDimCategories, chConstants.chDataLiteral, xValues
            .SetData chConstants.chDimValues, chConstants.chDataLiteral, yValues1
            .Type = chConstants.chChartTypeColumnClustered
        End With

        'Add another series to the chart with the x-values and y-values
        'from the arrays and set the series type to a line chart
        Set oSeries = oChart.SeriesCollection.Add
        With oSeries
            .Caption = "1996"
            .SetData chConstants.chDimCategories, chConstants.chDataLiteral, xValues
            .SetData chConstants.chDimValues, chConstants.chDataLiteral, yValues2
            .Type = chConstants.chChartTypeLineMarkers
        End With

        'Add a value axis to the right of the chart for the second series
        oChart.Axes.Add oChart.Axes(chConstants.chAxisPositionLeft).Scaling,chConstants.chAxisPositionRight, chConstants.chValueAxis

        'Format the Value Axes
        oChart.Axes(chConstants.chAxisPositionLeft).NumberFormat = "$#,##0"
     oChart.Axes(chConstants.chAxisPositionRight).NumberFormat = "0"
     oChart.Axes(chConstants.chAxisPositionLeft).MajorUnit = 20000
        oChart.Axes(chConstants.chAxisPositionRight).MajorUnit = 20000

        'Show the legend at the bottom of the chart
        oChart.HasLegend = True
        oChart.Legend.Position = chLegendPositionBottom

    End Sub
    Private Sub Command2_Click()

        'Set up the DataSourceControl for the Chartspace
        Dim rsd, chConstants
        Set chConstants = ChartSpace1.Constants
        DataSourceControl1.ConnectionString = _
            "DRIVER={Microsoft Access Driver (*.mdb)}; " & _
            "DBQ=C:\Program Files\Microsoft Visual Studio\VB98\nwind.mdb"
        Set rsd = DataSourceControl1.RecordsetDefs.AddNew( _
                 "Select * from [Category Sales for 1995]", 3)
        With ChartSpace1
            .Clear
            .Refresh
            .DataSource = DataSourceControl1
            .DataMember = rsd.Name
        End With

        'This Chartspace will contain 2 charts. Make the layout so that the
        'charts are positioned horizontally
        ChartSpace1.ChartLayout = chConstants.chChartLayoutHorizontal

        'Create a new bar chart from the query
        Dim oBarChart
        Set oBarChart = ChartSpace1.Charts.Add
        With oBarChart
            .Type = chConstants.chChartTypeBarClustered
            .SetData chConstants.chDimCategories, 0, 0  'Categories are first field
            .SetData chConstants.chDimValues, 0, 1      'Values are second field

            'Format the value axis for the bar chart so that it
            'shows values in thousands (i.e., 45000 displays as 45) and
            'in increments of 25000. Remove the gridlines
            With .Axes(chConstants.chAxisPositionBottom)
                .NumberFormat = "0,"
                .MajorUnit = 25000
                .HasMajorGridlines = False
            End With

            'Change the color of the series and the plot area
            .SeriesCollection(0).Interior.Color = RGB(150, 0, 150)
            .PlotArea.Interior.Color = RGB(240, 240, 10)
        End With

        'Create a new exploded pie chart from the query
        Dim oPieChart
        Set oPieChart = ChartSpace1.Charts.Add
        With oPieChart
            .Type = chConstants.chChartTypePie
            .SetData chConstants.chDimCategories, 0, 0  'Categories are first field
            .SetData chConstants.chDimValues, 0, 1      'Values are second field
            .SeriesCollection(0).Explosion = 20

            'Add a legend to the bottom of the pie chart
            .HasLegend = True
            .Legend.Position = chConstants.chLegendPositionBottom

            'Add a title to the chart
            .HasTitle = True
            .Title.Caption = "Sales by Category for 1995"
            .Title.Font.Bold = True
            .Title.Font.Size = 11

            'Make the chart width 50% the size of the bar chart's width
            .WidthRatio = 50

            'Show data labels on the slices as percentages
            With .SeriesCollection(0).DataLabelsCollection.Add
                .HasValue = False
                .HasPercentage = True
                .Font.Size = 8
                .Interior.Color = RGB(255, 255, 255)
            End With

        End With

    End Sub
    Private Sub Command3_Click()

       'Dynamically add a spreadsheet control to the form
       Dim chConstants
       Set chConstants = ChartSpace1.Constants
     
       'Fill the Sheet with data
       With oSheet
            .Range("A1:A10").Formula = "=Row()"
            .Range("B1:B10").Formula = "=A1^2"
            .Range("A12").Formula = "=Max(A1:A10)"
            .Range("B12").Formula = "=Max(B1:B10)"
       End With

       'Create an xy-scatter chart using the data in the spreadsheet
       Dim oChart
       With ChartSpace1
            .Clear
            .Refresh
            .DataSource = oSheet.object
            Set oChart = .Charts.Add
            oChart.Type = chConstants.chChartTypeScatterSmoothLineMarkers
            oChart.SetData chConstants.chDimXValues, 0, "a1:a10"
            oChart.SetData chConstants.chDimYValues, 0, "b1:b10"
       End With

       With oChart
            'Display the Axes Titles and
            'set the major units for the axes
            With .Axes(chConstants.chAxisPositionBottom)
                .HasTitle = True
                .Title.Caption = "X"
                .Title.Font.Size = 8
                .MajorUnit = 1
            End With
            With .Axes(chConstants.chAxisPositionLeft)
                .HasTitle = True
                .Title.Caption = "X Squared"
                .Title.Font.Size = 8
                .MajorUnit = 10
            End With

            'Set the maximum and minimum axis values
            .Scalings(chConstants.chDimXValues).Maximum = oSheet.Range("A12").Value
            .Scalings(chConstants.chDimXValues).Minimum = 1
            .Scalings(chConstants.chDimYValues).Maximum = oSheet.Range("B12").Value

            'Change the marker and line styles for the series
            With .SeriesCollection(0)
                .Marker.Style = chConstants.chMarkerStyleDot
                .Marker.Size = 6
                .Line.Weight = 1
                .Line.Color = RGB(255, 0, 0)
            End With
       End With
    End Sub
    </SCRIPT>
    </HEAD>
    <BODY>
    <!-- 声明一个图表对象ChartSpace1-->
    <object id=ChartSpace1 classid=CLSID:0002E500-0000-0000-C000-000000000046 codebase=”msowc.dll” style="width:100%;height:350;border:#ffffff 0px solid"></object>
    <!-- 声明一个图表数据源对象DataSourceControl1 -->
    <object id=DataSourceControl1 classid=CLSID:0002E55B-0000-0000-C000-000000000046></object>
    <!-- 声明一个电子表格对象oSheet -->
    <object id=oSheet classid=CLSID:0002E559-0000-0000-C000-000000000046 style="width:0;height:0;border:#ffffff 0px solid"></object>


    <INPUT TYPE="button" language="vbscript" onclick="Command1_Click()" value="使用数组">
    <INPUT TYPE="button" language="vbscript" onclick="Command2_Click()" value="使用ado记录机">
    <INPUT TYPE="button" language="vbscript" onclick="Command3_Click()" value="使用电子表格">
    </BODY>
    </HTML>
    <!-- 做了半截注释,不想做了,里面大家不懂的参数什么的,大家自己参考相关资料算了,我得下班了,如果你装了OFFICE,在OFFICE的安装目录下面有个OWCVBA11.CHM的文件,你打开它,关于OWC的资料非常详细了,可能这个帮助文件的名字会根据你安装的OFS的版本不同而不同 -->

    发表于 @ 2005年04月23日 18:44:00|评论(loading...)|编辑

    新一篇: WawaKM征集4名有兴趣参与开源项目人员 | 旧一篇: 蛙蛙推荐:微软网络讲座系列教程视频下载(2004年1月到2005年4越)

    评论

    #kczm 发表于2005-07-02 02:28:00  IP: 61.186.252.*
    Link:http://www.hktk.net
    #深圳网页设计 发表于2005-07-02 02:29:00  IP: 61.186.252.*
    The second link.
    发表评论  


    当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
    Csdn Blog version 3.1a
    Copyright © 蛙蛙王子