Click here to Skip to main content
11,408,835 members (63,088 online)
Click here to Skip to main content
Add your own
alternative version

Interactive 3D bar chart custom control in WPF with rotation, touch-sense display, and databinding support

, 29 Mar 2009 CPOL
Create a WPF 3D Bar chart in your .NET application easily. You can create interactive 3D bar charts in seconds using this WPF 3D bar chart custom control. You can even databind your input to see the '3D chart bar change live as you enter your input' effect.
Wpf3DChartDemo.zip
WPF3DChartDemo
Test3DChart.exe
Wpf3DChartTutorial.dll
WPF3DChartSource.zip
Test3DChart
Test3DChart
bin
Debug
Test3DChart.exe
Test3DChart.vshost.exe
Test3DChart.vshost.exe.manifest
Visual Studio 2008
Settings
CurrentSettings.vssettings
Visualizers
attribcache90.bin
autoexp.dll
autoexpce.dll
Wpf3DChartTutorial.dll
Release
Test3DChart.exe
Test3DChart.vshost.exe
Test3DChart.vshost.exe.manifest
Wpf3DChartTutorial.dll
Properties
Settings.settings
Visual Studio 2008
Backup Files
Test3DChart
Wpf3DChartTutorial
Wpf3DChartTutorial
bin
Debug
Visual Studio 2008
Backup Files
Test3DChart
Settings
CurrentSettings.vssettings
Wpf3DChartTutorial.dll
Release
Wpf3DChartTutorial.dll
Properties
Settings.settings
Themes
wpf3d.JPG
Visual Studio 2008
Backup Files
Wpf3DChartTutorial
Wpf3DChartTutorial.csproj.user
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.Media3D;
using System.Windows.Media;

namespace Wpf3DChartTutorial
{
    internal class HitDetails
    {
        private Point3D p0, p1, p2, p3, pointToWrite;
        private Color barColor;
        Point3D pointToStart;
        double barHeight, barWidth;
        private string xItem, yItem, zItem;
        bool showValue;
        StringBuilder strToDisplay;

        public HitDetails(string XItemParam, string YItemParam, string ZItemParam, Point3D P0, Point3D P1, Point3D P2, Point3D P3, Point3D PointToWrite, Point3D PointToStartParam, double Width, double Height, Color BarColorParam)
        {
            xItem = XItemParam;
            yItem = YItemParam;
            zItem = ZItemParam;
            p0 = P0;
            p1 = P1;
            p2 = P2;
            p3 = P3;
            strToDisplay = new StringBuilder();
            pointToWrite = PointToWrite;
            barColor = BarColorParam;

            pointToStart = new Point3D(PointToStartParam.X, PointToStartParam.Y, PointToStartParam.Z);
            pointToStart.X -= 0.25;
            pointToStart.Z += 0.25;
            barHeight = Height + 0.5;
            barWidth = Width + 0.5;
            Update();
        }

        public void Update()
        {
            strToDisplay.Length = 0;
            strToDisplay.AppendFormat("X={0}; Y={1}; Z={2}", xItem, yItem, zItem);
        }

        public Point3D PointToWrite
        {
            get
            {
                return pointToWrite;
            }
        }

        public string StringToDisplay
        {
            get
            {
                return strToDisplay.ToString();
            }
        }

        public bool ShowValue
        {
            get
            {
                return showValue;
            }

            set
            {
                showValue = value;
            }
        }

        public string XItem
        {
            get
            {
                return xItem;

            }
        }

        public string YItem
        {
            get
            {
                return yItem;
            }
        }

        public string ZItem
        {
            get
            {
                return zItem;
            }
        }

        public Point3D P0
        {
            get
            {
                return p0;
            }
        }

        public Point3D P1
        {
            get
            {
                return p1;
            }
        }

        public Point3D P2
        {
            get
            {
                return p2;
            }
        }

        public Point3D P3
        {
            get
            {
                return p3;
            }
        }

        public Point3D PointToStart
        {
            get
            {
                return pointToStart;
            }
        }

        public double Height
        {
            get
            {
                return barHeight;
            }
        }

        public double Width
        {
            get
            {
                return barWidth;
            }
        }

        public Color BarColor
        {
            get
            {
                return barColor;
            }
        }

    
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Bharath K A
Software Developer (Senior)
United States United States
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150414.5 | Last Updated 29 Mar 2009
Article Copyright 2008 by Bharath K A
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid