I am struggling to find an answer or if this is something that can be done.
I have a datatable "SFTable" and a chart "GPSChart" and I add series "SFLine" to it.
I would like to specify beginning and end rows of the datatable that I want plotted. So if I only want to plot rows 45-234 out of the datatable, how would I go about that?
Not sure that databind is the best thing for this, but I don't really know any other options, I'm new to this. Thanks
If Not SFDrawn Then GPSChart.Series.Add("SFLine")
With GPSChart.Series("SFLine")
.ChartType = DataVisualization.Charting.SeriesChartType.Line
.Points.DataBind(TestDatabaseDataSet3.Tables("SFTable"), "Latitude", "Longitude", Nothing)
End With
Related
I'm still relatively new to programming and I have a project I am working on. I am making a staff efficiency dashboard for a fictional pizza company. I want to find the quickest pizza making time and display the time and the staff members name to the user.
With the data charts it has been easy. Create a function, then use dc, e.g dc.barChart("#idOfDivInHtmlPage")
I suspect I might be trying to be too complicated, and that I've completely forgotten how to display any outputs of a js function to a html page.
I've been using d3.js, dc.js and crossfilter to represent most of the data visually in an interactive way.
Snippet of the .csv
Name,Rank,YearsService,Course,PizzaTime
Scott,Instore,3,BMC,96
Mark,Instore,4,Intro,94
Wendy,Instore,3,Intro,76
This is what I've tried so far:
var timeDim = ndx.dimension(function(d) {
return [d.PizzaTime, d.Name]
});
var minStaffPizzaTimeName = timeDim.bottom(1)[0].PizzaTime;
var maxStaffPizzaTimeName = timeDim.top(1)[0].PizzaTime;
}
then in the html
<p id="minStaffPizzaTimeName"></p>
<script type="text/javascript" src="static/js/graph.js">
document.write("minStaffPizzaTimeName");
</script>
You are surely on the right track, but in javascript you often have to consider the timing of when things will happen.
document.write() (or rather, anything at the top level of a script) will get executed while the page is getting loaded.
But I bet your data is loaded asynchronously (probably with d3.csv), so you won't have a crossfilter object until a bit later. You haven't shown these parts but that's the usual way to use crossfilter and dc.js.
So you will need to modify the page after it's loaded. D3 is great for this! (The straight javascript way to do this particular thing isn't much harder.)
You should be able to leave the <p> tag where it is, remove the extra <script> tag, and then, in the function which creates timeDim:
d3.select('#minStaffPizzaTimeName').text(minStaffPizzaTimeName);
This looks for the element with that ID and replaces its content with the value you have computed.
General problem solving tools
You can use the dev tools dom inspector to make sure that the p tag exists with id minStaffPizzaTimeName.
You can also use
console.log(minStaffPizzaTimeName)
to see if you are fetching the data correctly.
It's hard to tell without a running example but I think you will want to define your dimension using the PizzaTime only, and convert it from a string to a number:
var timeDim = ndx.dimension(function(d) {
return +d.PizzaTime;
});
Then timeDim.bottom(1)[0] should give you the row of your original data with the lowest value of PizzaTime. Adding .Name to that expression should retrieve the name field from the row object.
But you might have to poke around using console.log or the interactive debugger to find the exact expression that works. It's pretty much impossible to use dc.js or D3 without these tools, so a little investment in learning them will pay off big time.
Boom, finally figured it out.
function show_fastest_and_slowest_pizza_maker(ndx) {
var timeDim = ndx.dimension(dc.pluck("PizzaTime"));
var minPizzaTimeName = timeDim.bottom(1)[0].Name;
var maxPizzaTimeName = timeDim.top(1)[0].Name;
d3.select('#minPizzaTimeName')
.text(minPizzaTimeName);
d3.select('#maxPizzaTimeName')
.text(maxPizzaTimeName);
}
Thanks very much Gordon, you sent me down the right path!
i want to display the data into DataGrid manually in VB6, source of data is not from database or other source. I have created the column, like this:
For i = 2 To 4
DataGrid1.Columns.Add i
Next i
DataGrid1.Columns(0).Caption = "No"
DataGrid1.Columns(1).Caption = "Subdataset"
DataGrid1.Columns(2).Caption = "Dimension"
DataGrid1.Columns(3).Caption = "Check"
DataGrid1.Columns(3).Caption = "Detail"
but i can't add row and add value into it, i have tried like this:
Me.DataGrid1.AllowUserToAddRows = True
DataGrid1.Row = DataGrid1.Row + 1
then i got error
Please tell me if anybody can help me, thank you
Not only is DataGrid designed to be a bound control, it doesn't support unbound use. Says so right in the doc. So, the short answer is that you can't do what you are trying to do, because it's designed to display values from a database.
Instead, you'll want to use the MSFlexGrid control (Not the MSHFlexGrid control, although some of the doc confuses them), which you can read about here. Suppose you play around with that (the AddItem method is the fundamental piece you need to work with) and post back with specifics if you have problems.
Once you have added the table (DataGrid) right click select edit then you can insert columns:
I would like to exclude a LineChart from updating if I filter using Pie-Chart-1 but would like it to update however if I filter using Pie-Chart-2.
Hopefully that makes sense, if not I will to get a jsfiddle sorted to show an example but currently having a problem getting onto the site.
Many thanks.
I will assume that the pie charts dont filter each other out as well.
In that case you can assign separate dc render events to the chart sets which you want to filter. Assuming you have pieChart1, pieChart2, lineChart1, lineChart2
and you want lineChart1 to update only on selecting a pieChart1 Slice and similarly for the pieChart2 - lineChart2 combo.
Define your charts and give the charts with same filtering a same render event name.
var pieChart1 = dc.pieChart("#pie1", "filterView1");
var lineChart1 = dc.lineChart("#line1", "filterView1");
var pieChart2 = dc.pieChart("#pie2", "filterView2");
var lineChart2 = dc.lineChart("#line2", "filterView2");
And then finally after defining your chart properties, call two separate render events
dc.renderAll("filterView1");
dc.renderAll("filterView2");
This way you can make your own render groups for custom filtering.
I'm using the free version of AmCharts, and I have a simple question - how do you delete a Chart after it has been loaded? I've searched the internet, but haven't come up on much.
If you want to destroy the chart object, at all, call:
chart.clear();
and then null the chart variable:
chart = null;
Also you can destroy(delete) the chart using these two simple methods
chart is not a key word you can change whatever you want to name your chart for example my chart name is ActionPieChart ActionPieChart.destroy();
chart.destroy();
or
chart= null;
If by delete you mean delete from the page or to hide it, you could also use:
document.getElementById('[[ChartDIV]]').style.display = 'none';
I would like to add items to a dropdownlist progmatically.
I have an empty drop downlist and depending on a number of factors I then populate it with various action choices.
the Drop Down list is called dlFirstChoice and I would like to add some values to it, can some one give me the basic code to do so, I have tired ILists and Arrays as the Dataprovider but clearly Im doing something wrong.
Please and thank you in advance for any help.
var dropListDb:ArrayList=new ArrayList();
dropListDb.addItem({label: "Equals (List)"});
dropListDb.addItem({label: "Is Between"});
dlFirstChoice.visible = true;
dlFirstChoice.dataProvider=dropListDb;
dlFirstChoice.selectedIndex=0;