Visifire使用笔记 1

Visifire使用笔记 1初始化生成一个堆叠柱状图,点击不同的堆叠部分显示该部分的详情,用柱状图。点击柱状图继续显示详情,用饼图。透明度从0到1的切换效果。BACK按钮,返回上一张Chart。XAML:<UserControlx:Class=”Simple.Page”xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presenta…

大家好,又见面了,我是你们的朋友全栈君。

初始化生成一个堆叠柱状图,点击不同的堆叠部分显示该部分的详情,用柱状图。点击柱状图继续显示详情,用饼图。透明度从0到1的切换效果。BACK按钮,返回上一张Chart。

XAML:

<UserControl x:Class=”Simple.Page”

    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 

    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” 

    Width=”800″ Height=”640″>

    <Grid x:Name=”LayoutRoot” Background=”White”>

        <Grid.Resources>

            <Storyboard x:Name=”storyboard”>

                <DoubleAnimation  x:Name=”storyboardDA” From=”1″ To=”0″

Storyboard.TargetName=”ChartPanel” Storyboard.TargetProperty=”UIElement. Opacity”

                       

AutoReverse=”False”  Duration=”0:0:1″  >

                </DoubleAnimation>

            </Storyboard>

        </Grid.Resources>

        <StackPanel>

            <Grid x:Name=”ChartPanel” Height=”600″ Width=”800″>

            </Grid>

            <Button x:Name=”Btn_Back” Width=”100″ Height=”40″ Content=”Back”  Click=”Btn_Back_Click” ></Button>

        </StackPanel>

    </Grid>

</UserControl> 

 

CS:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

using Visifire.Charts;

using Visifire.Commons;

namespace Simple

{

    public partial class Page : UserControl

    {

        public Page()

        {

            InitializeComponent();

            // Create a new Visifire Chart

            CreateChart();

        }

        /// <summary>

        /// Function to create a chart

        /// </summary>

        public void CreateChart()

        {

            Chart chart = new Chart();

            chart.View3D = true;

            chart.Width = 800;

            chart.Height = 600;

            Title title = new Title();

            title.Text = “SL CHART DEMO”;

            chart.Titles.Add(title);

            for (int c = 0; c < 3;c++ )

            {

                DataSeries dataSeries = new DataSeries();

                dataSeries.RenderAs = RenderAs.StackedColumn;

                dataSeries.LegendText = c.ToString();

                DataPoint dataPoint;

                for (int i = 0; i < 5; i++)

                {

                    dataPoint = new DataPoint();

                    dataPoint.YValue = rand.Next(10, 100);

                    dataPoint.MouseLeftButtonDown += new MouseButtonEventHandler(dataPoint_MouseLeftButtonDown);

                    dataSeries.DataPoints.Add(dataPoint);

                }

                chart.Series.Add(dataSeries);

            }

            this.ChartPanel.Children.Add(chart);

            this.currentSetp = 1;

        }

        void dataPoint_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)

        {

            this.HideDispaly();

            this.ChartPanel.Children.Clear();

            this.CreateCreateColumnChart();

        }

        void dataPoint_MouseLeftButtonDownColumnChart(object sender, MouseButtonEventArgs e)

        {

            this.HideDispaly();

            this.ChartPanel.Children.Clear();

            this.CreateCreatePieChart();

        }

        private void CreateCreatePieChart()

        {

            Chart chart = new Chart();

            chart.View3D = true;

            chart.Width = 800;

            chart.Height = 600;

            Title title = new Title();

            title.Text = “SL CHART DEMO”;

            chart.Titles.Add(title);

            DataSeries dataSeries = new DataSeries();

            dataSeries.RenderAs = RenderAs.Pie;

            dataSeries.LegendText = “”;

            DataPoint dataPoint;

            for (int i = 0; i < 5; i++)

            {

                dataPoint = new DataPoint();

                dataPoint.YValue = rand.Next(10, 100);

                dataSeries.DataPoints.Add(dataPoint);

            }

            chart.Series.Add(dataSeries);

            this.ChartPanel.Children.Add(chart);

            this.currentSetp = 3;

        }

        private void CreateCreateColumnChart()

        {

            Chart chart = new Chart();

            chart.View3D = true;

            chart.Width = 800;

            chart.Height = 600;

            Title title = new Title();

            title.Text = “SL CHART DEMO”;

            chart.Titles.Add(title);

            DataSeries dataSeries = new DataSeries();

            dataSeries.RenderAs = RenderAs.Column;

            dataSeries.LegendText = “”;

            DataPoint dataPoint;

            for (int i = 0; i < 5; i++)

            {

                dataPoint = new DataPoint();

                dataPoint.YValue = rand.Next(10, 100);

                dataPoint.MouseLeftButtonDown += new MouseButtonEventHandler(dataPoint_MouseLeftButtonDownColumnChart);

                dataSeries.DataPoints.Add(dataPoint);

            }

            chart.Series.Add(dataSeries);

            this.ChartPanel.Children.Add(chart);

            this.currentSetp = 2;

        }

        /// <summary>

        /// Create a random class variable

        /// </summary>

        Random rand = new Random(DateTime.Now.Millisecond);

        private int currentSetp = 0;

        private void GoStep(int currentStep)

        {

            

            if (currentStep == 1)

            {

                return;

            }

            if (currentStep == 2)

            {

                this.ChartPanel.Children.Clear();

                this.CreateChart();

            }

            if (currentStep == 3)

            {

                this.ChartPanel.Children.Clear();

                this.CreateCreateColumnChart();

            }

        }

        private void Btn_Back_Click(object sender, RoutedEventArgs e)

        {

            this.GoStep(currentSetp);

            this.HideDispaly();

        }

        private void HideDispaly()

        {

            this.storyboardDA.From = 0;

            this.storyboardDA.To = 1;

            this.storyboard.Begin();

        }

    }

}

 

 Visifire使用笔记 1

Visifire使用笔记 1 

 Visifire使用笔记 1

 

转载于:https://www.cnblogs.com/kklldog/archive/2010/07/02/1769886.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/162812.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 十八、职责链模式-推卸责任,不关我的事,我不管!#和设计模式一起旅行#

    不在其位,不谋其政! –出自《论语·泰伯》故事背景在现实世界中,有很多情况下会遇到一些推卸责任的场景,比如要办理一件事的时候,被告诉你要去做个做这个事情,但是去了这个地方,确告诉要到另一个地方去,最后搞了很久,才办完这一件事。这种情况下,就可以简单的称为踢皮球,也就是推卸责任。在软件中,当外部请求程序进行某个出来,这个程序无法处理就把该请求转给其他对象负责,当对个对象组…

    2022年2月27日
    36
  • windows驱动开发教程_windows内核驱动开发

    windows驱动开发教程_windows内核驱动开发1.前言因工作上项目的需要,笔者需要做驱动相关的开发,之前并没有接触过相关的知识,折腾一段时间下来,功能如需实现了,也积累了一些经验和看法,所以在此做番总结。对于驱动开发的开发指引,微软官方文档网站已经提供了很详细的教程文档,并且在Github上提供了一系列典型的例程源码用于开发人员参考。开发人员在具备一定的驱动概念知识后,通过参考官方例程可以很容易实现拥有特定功能的驱动应用程序。Windows驱动程序入门:Windows驱动程序入门-Windowsdrivers|Micros..

    2022年8月30日
    3
  • R语言批量生成CaseWhen的解决方案

    R语言批量生成CaseWhen的解决方案R语言case_when批量生成自定义函数

    2025年9月20日
    4
  • 2019年长沙前端技术分享大会圆满成功

    做一个积极的人编码、改bug、提升自己我有一个乐园,面向编程,春暖花开!本文首发: 唐胡子俱乐部,授权发布!摘要长沙百名互联网前端程序员齐聚长沙互联网活动基地(唐胡子俱乐部)。主办单位:唐胡子俱乐部支持单位:芒果TV,拓维,湘邮,58到家,御泥坊,兴盛优选,中软国际,长海科技,长沙联通时 间:2019年5月19日—————————-…

    2022年2月28日
    401
  • 针对浏览器主页被360或hao123锁定的解决方法

    针对浏览器主页被360或hao123锁定的解决方法除了常规的更改用户组策略来防止修改,更需要注意的是IE浏览器快捷方式的属性修改,这一点是不会被组策略及杀毒软件察觉的。如图所示的目标栏,"C:\ProgramFiles\InternetExplorer\iexplore.exe"后面会被加上www.hao123.com的网址,这样在你用IE的快捷方式打开浏览器时,会跳转到hao123的主页。解决办法:将"C:\ProgramFiles\In…

    2022年7月26日
    55
  • exosip「建议收藏」

    exosip「建议收藏」exosip针对UA是对osip进行扩展,oSIP不提供不论什么高速产生请求消息和响应消息的方法,全部请求消息和响应消息的形成必须调用一组sipmessageapi来手动组装完毕,所以作者在osi

    2022年7月1日
    42

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号