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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 新手学计算机编程怎么入门 从哪学起

    新手学计算机编程怎么入门 从哪学起近些年有一种职业发展很快、人才需求量大、工资高,那就是程序员。他们的基本工作就是电脑编程,开发者各种各样的软件、APP,被很多人膜拜。如果你想成为一名程序员,有必要了解一下这些基本的电脑编程入门教程。1计算机编程怎么入门1、选择一门编程语言。虽然目前编程语言有600种左右,但是比较流行的编程语言只有几十种,所以尽量选择流行程度比较高的编程语言来入门编程。对于没有明确编程场景的初学者来说,尽量选择全场景编程语言,比如Java、Python、就是不错的选择,不仅应用范围广泛,而且也有大量的开发案例可以参

    2022年6月15日
    34
  • java static关键字的作用是什么_java中的static关键字

    java static关键字的作用是什么_java中的static关键字一、static代表着什么在Java中并不存在全局变量的概念,但是我们可以通过static来实现一个“伪全局”的概念,在Java中static表示“全局”或者“静态”的意思,用来修饰成员变量和成员方法,当然也可以修饰代码块。Java把内存分为栈内存和堆内存,其中栈内存用来存放一些基本类型的变量、数组和对象的引用,堆内存主要存放一些对象。在JVM加载一个类的时候,若该类存在static修饰的成员变量…

    2022年7月8日
    18
  • 二代身份证校验[通俗易懂]

    二代身份证校验[通俗易懂]百度一搜就能搜到很多身份证校验的例子,这个是最近做项目参考百度文库的demo修改后的一,js:[code="js"]//身份验证functioncheckIdCard(idCard){ varsexId; varsexText; varage; varErrors=newArray("验证通过!","身份证号码位数不对!","身份证号码出生…

    2022年6月27日
    31
  • ipv6双向网关_IPv4_IPv6转换网关·····[通俗易懂]

    IPV4/IPV6转换网关的研究与设计摘要:随着计算机网络应用的飞速进步,现有的IP通信协议(IPv4协议)已展现出众多的问题,如不能适应新的网络应用、地址资源即将耗尽以及对安全性无法保证等。IPv6是继IPv4后出现的新一代通信协议,它的出现为互联网的发展带来了新契机。IPv6的众多优势成为取代IPv4必然的发展。本文从IPv6协议本身出发,阐述了IPv6协议及其与IPv4协议的比较,对目前现有…

    2022年4月9日
    62
  • IGMP协议_igmp协议常用3种报文

    IGMP协议_igmp协议常用3种报文IGMP介绍

    2025年11月18日
    3
  • 组函数及分组统计[通俗易懂]

    组函数及分组统计

    2022年2月1日
    43

发表回复

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

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